LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

getting both intensity AND postion information on particles with IMAQ

Greetings-

I am trying to use IMAQ to analyze images which contain "particles".  I have no problem making a binary mask that contains only the particles of interest and using "IMAQ Particle Analysis" to give me an array containing the (X,Y) locations of the centers of these particles.

I also have no problem converting the binary mask to a 16 bit image in which each particle has its own unique label.  I then use this labeling image and the original greyscale image as inputs to "IMAQ Quantify" so that I obtain the average greyscale density for each particle.

Here is my problem:  the two data sets are completely divorced.  I need correlate the density information for a given particle with its location in the image.

Can anyone suggest a solution?  (I am running 8.0)

Thanks,
-GN
0 Kudos
Message 1 of 9
(3,852 Views)
GN,
 
You can use the labeled particle image to selectively mask the particle regions of interest in the original image to do custom analysis on that original image particle.  The labeled image will "color code" each particle with a gray-scale value starting at 1.  You can use a custom LUT to go through the labeled image particle-by-particle and clear all but the particle of interest.  For instance, a LUT with 0-255 mapped to 0, 255, 0, 0, ..., 0 will result in a binary image that only contains particle "1" (colored with a value of 255).  You can then use this image as a mask to clear everything but the particle's pixels in the original image.
 
-cb
0 Kudos
Message 2 of 9
(3,850 Views)
CB-

Thanks for the reply.  I had already come to a similar solution using thresholding rather than an LUT, but both solutions share the same characteristic:  they are slower than glacial.  Each image has on the order of 5000 particles.  This process proceeds at something faster than 1 particle per second, but not as fast as 2 particles per second. 

Anyone have an alternative?

Thanks,
-GN
0 Kudos
Message 3 of 9
(3,826 Views)
Hi GN,

Let me suggest the following:

The "IMAQ Particle Analysis" VI is going to return an array(1) that contains the coordinates for the centre of mass for each particle.  Assuming that your 16-bit greyscale mask is done correctly, this means that every pixel within a particle shares the same value, and every particle will have its own unique16-bit value.

You also have an array(2) of densities that you found using "IMAQ Quantify", which are indexed according to the particle values.

What you need to do, is to create a for loop whose number of executions is controller by the number of items in Array 1 or Array 2 (# particles you have).  You can pass N the array size or just use auto-indexing.  Use the "IMAQ GetPixelValue" VI, and pass it the coordinates for each centre of mass (array 1).  Provided that your particles do not have odd shapes, and that the centre of mass is included as part of this particle (and not in a hole), the VI will return the corresponding 16-bit greyscale value.  Use the Index Array function, the returned value of "IMAQ GetPixelValue" and the Density Array to get the density value for that centre of mass.  You can then build an Array with all the information that you want to correlate.

(I have attached a screenshot diagram that may help you to understand what I'm trying to say)

I hope this helps, if you have any other questions, please let me know!
Rishi L
National Instruments
Applications Engineer
Message 4 of 9
(3,803 Views)
Rishi-

Thank you!  That works beautifully and very fast!  It works particularly well when I remember to subtract 1 from the pixel value to that it matches the 0...N-1 range of indices in the array of Region Reports.

Have a good one!

-Geoff
0 Kudos
Message 5 of 9
(3,785 Views)

GN wrote:

..I also have no problem converting the binary mask to a 16 bit image in which each particle has its own unique label.  I then use this labeling image .. -GN


How do you do that labeling i.e. How to assign all pixels in any given particle to a distinct value?

 

Thanks for any tips.

0 Kudos
Message 6 of 9
(3,406 Views)

Figured it out, quick drop (^ctrl space) is my friend: "IMAQ Label" will do the labeling!

 

Sorry for disturbing.

0 Kudos
Message 7 of 9
(3,404 Views)

iRish wrote:
..Assuming that your 16-bit greyscale mask is done correctly, this means that every pixel within a particle shares the same value, and every particle will have its own unique16-bit value.
.

Based on the excellent ideas put forward in this thread on particle analysis in both morphology metrics and intensity statistics I have made a VI (attached) which generalizes further :

a) It is working for any shape of particle, even hollow ones or particles inside other particles (It uses first pixelX,Y to probe label of particle rather than centre of mass which fails for certain shapes)

b) It returns morphologic measurements (any results of "IMAQ particle analysis") defined by the caller together with the intensity statistics returned by "IMAQ quantify".

 

Hope its of use. Let me know of any errors or improvements you find.

 

Henning

0 Kudos
Message 8 of 9
(3,389 Views)

I forgot to include a tester harness. Attached please find a faily simple one in which you manually create your image and particle mask - pixel by pixel to play with various configurations. There are surely smarter ways, but this was what I arrived at in my iterations.

Let us know of any errors or improvements.

 

Henning

Message 9 of 9
(3,380 Views)