Germination count on trays

imagej
particle-counting

#1

Hello!

For my bachelor thesis I am working on a project for which I will have to record the germination count for a 96 hole tray. I will have to do this weekly, for 1000 samples, so I would like to automate the process. I am very new to ImageJ, but I thought of a way to count the boxes in a grid that have no green pixels. I need some simple explanation please. The grid on the picture I added in ImageJ.

Thank you very much for any reply.

Rick


ImageJ Functionality
Multiple data point on image
#2

Good day Rick,

the image looks familiar …
http://forum.image.sc/t/find-a-grid-and-analyze-it/9995?u=herbie

I’d use a square-selection that is moved over the matrix and measure the percentage green for every position.

Could you please post the original raw image in TIF- or PNG-format.

Regards

Herbie


#3

Hello Herbie,

Do you mean recording the macro measuring every plant-hole on %green? That seems like a good idea! Is there a way that i can get the results listed in excel?

Rick


#4

[…] measuring every plant-hole on %green?

Yes.
Maybe the ROI-manager is helpful, as well as multi-measure.

Is there a way that i can get the results listed in excel?

Sure, just put all measurements in a results table.

Be successful

Herbie


#5

Thank you for your reply! I have made 96 regions in the ROI manager! As you can see in the picture below. How do i peform an analysis of the amount of red particles on every region?

Rick


#6

Rick,

please study the ImageJ user guide and especially the section about thresholding and the ROI-manager:
https://imagej.nih.gov/ij/docs/guide/index.html

How did you proceed to get the image?

Regards

Herbie

ADDITION:

I would not binarize the image.

  1. Perhaps you split the RGB-image and work with the green channel only.
  2. Then store the 96 selections in the ROI-Manager.
  3. Check “Mean” and “Median” in “Set Measurement”.
  4. Perform “Multi Measure” from the ROI-Manager.

This will get you a results table with 96 entries.


#7

Hello Herbie,

That is helpful yes, I did get 3 grey images, but it worked too. The empty slots(not germinated) have a significant lower grey value (mean). But would there be a way to count only green pixels? There is a risk now that the very small seedlings will be counted as empty.

Anyway, I really appreciate your help! I did not use multi measure but just measure. Multi measure would give me 192 entries.

What do you want to know about how I proceeded to get the image?

Thanks! Rick


#8

Are the red areas there because you adjusted the threshold? In this case you can either use the particle analyzer to measure the objects but then you have to handle the empty positions.
It would probably be easier to write a macro that iterates over the rois in the roi-manager. All it has to do for each roi is:

  • duplicate
  • create selection
  • measure
    Before the “create selection” step you can check if the region is empty and report 0 in this case
    Regards,
    Volker

#9

Multi measure would give me 192 entries.

Surely not!
You may have entered the ROIs two times …

But would there be a way to count only green pixels?

You may try the color threshold. I think you did this already.
(Select, then clear outside, then apply the selections stored in the ROI-Manager.)

Perhaps better is to stay with the green channel and apply a suitable automatic achromatic threshold. This binary image is what I got with a hand-set threshold and median-filtering:

HTH

Herbie


#10

This works very good thanks! The empty slot is has both mean and median 0.


Now I will have to try to automate this process for 1000 samples.


#11

Ok i have tried to record a macro for doing this for one image, but I have a few questions:

  • How do I get this to work for a whole folder?
  • How do I get the brightness/contrast at a sed value for every picture?
  • How do I get the results of 1000 pictures in one table?

This is the macro I have so far:

open("C:/Users/Gebruiker/Google Drive/Afstuderen HZPC/1.Onderzoeksvoorstel/Image analysis/Testfoto's/DSC03818.JPG");
run("Median...", "radius=6");
run("Split Channels");
selectWindow("DSC03818.JPG (blue)");
close();
selectWindow("DSC03818.JPG (red)");
close();
//run("Brightness/Contrast...");
run("Apply LUT");
run("ROI Manager...");
roiManager("Open", "C:/Users/Gebruiker/Google Drive/Afstuderen HZPC/1.Onderzoeksvoorstel/Image analysis/Testfoto's/RoiSet2.zip");


run("Select All");
roiManager("Select", newArray(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95));
roiManager("Measure");
saveAs("Results", "C:/Users/Gebruiker/Google Drive/Afstuderen HZPC/1.Onderzoeksvoorstel/Image analysis/Foto's/Results.csv");

Thanks in advance for a reply!

Rick


#12

Good day Rick,

before you proceed, a central question need to be answered:

Is the geometry of your images always the same?
(Your sample image clearly shows geometric distortions, i.e. the tray isn’t a perfect rectangle.)

If this is not the case you can’t work with a fixed scheme for the positions of the little pots as you do with the array in your sample macro. Furthermore, you need to become flexible concerning the image names but this is much easier to accomplish …

Let’s start with the above question.

Regards

Herbie


#13

I have another question how central is this algorithm and this method you are developing in your bachelor’s thesis.
I mean are you more interested in the data you will get from this macro or the thesis is about develop an algorithm to do that?


#14

Hello Herbie,
These photo’s were sample photo’s. In two weeks I will start taking the pictures of the trays on a fixed position.
I just had some advice from an expert from the company where I do my thesis. I will work that out first. I will give an update when I worked something out!

I really appreciate your involvement

ADDITION
I found out that I had 192 measurements with multi measure because I had 2 values at set measurements (Median and Mean).


#15

Hello emartini,

The main focus is on aquiring the data that I will get from this macro.
If you are interested, for a potato breeding company I am investigation if there is a correlation between the vitality of potato seedlings - which is determined by several parameter such as length development, germination count and Leaf Area Index - and the performance of the plants when they are in the field. The reason is to make an early selection in the breeding programme to save space, since hundreds of thousands of seedlings are produces annually from which most are discarded at the end of the growing season.

Rick


#16

I found out that I had 192 measurements with multi measure because I had 2 values at set measurements (Median and Mean).

If you’ve correctly set the parameters in Multi Measure, this is not the case.

Regards

Herbie


#17

To come back to this topic.

With your help I found a way to analyse the photo.

  1. I make a custom grid with the ROI manager (Germination count on trays)
  2. I save these regions in a zip file.
  3. I set the measurements by analyse>set measurements… to mean grey value
  4. I record the a marco to set my image to the preferred black with image, so that the plants are black and the background is white. And I select the ROI’s in the ROI manager, by just selecting the list of ROI’s
  5. I choose process>batch>macro…
  6. I use the following macro:
// Color Thresholder 2.0.0-rc-65/1.51w
// Autogenerated macro, single images only!
min=newArray(3);
max=newArray(3);
filter=newArray(3);
a=getTitle();
run("HSB Stack");
run("Convert Stack to Images");
selectWindow("Hue");
rename("0");
selectWindow("Saturation");
rename("1");
selectWindow("Brightness");
rename("2");
min[0]=50;
max[0]=103;
filter[0]="pass";
min[1]=0;
max[1]=255;
filter[1]="pass";
min[2]=125;
max[2]=255;
filter[2]="pass";
for (i=0;i<3;i++){
  selectWindow(""+i);
  setThreshold(min[i], max[i]);
  run("Convert to Mask");
  if (filter[i]=="stop")  run("Invert");
}
imageCalculator("AND create", "0","1");
imageCalculator("AND create", "Result of 0","2");
for (i=0;i<3;i++){
  selectWindow(""+i);
  close();
}
selectWindow("Result of 0");
close();
selectWindow("Result of Result of 0");
rename(a);
// Colour Thresholding-------------

roiManager("multi-measure measure_all one append");

The color thresholder is available in the FIJI app.

  1. I select the folder with the picture that I want to be analysed.
  2. I copy the table in the measurements and paste it in excel
  3. I convert the mean grey value with to cm2 based on the scale of the ROI.
  4. Any plant hole that had no green will show a very low grey value, which means its not germinated. And for the plants that are germinated, I know the leaf area.

By the end of this week I will start to take pictures for the analysis.
Before that time I hope to add a QR-code decoder to the batch process, so I know which crossing the photo is taken from.

Thanks everyone for your support! I learned a lot.

If you have a similar project, I am happy to answer questions!

Rick