2

EDIT:

I have continued working on my problem among other things and have made significant process. Using one Dr. Ashby's macro provided on ImageJwiki, and using some of my own makeshift code I can now do batch processing of images taken of Hoescht, Calcein AM, and Ethidium Homodimer stains and get decent recognition of objects. Reducing exposure time and levels of stain used (specifically calcein AM) has helped with the pixel value cut offs I was dealing with earlier. The macro still has problems with distinguishing clumped cells from one another though. To address this issue I want to implement a command in my macro that divides clusters of cells that it identifies as one cell based on the average size of our cells. The only problem is that in all my reading I haven't seen anything that mentions this. Does anyone have any thoughts on how I could implement this code? I have copied the macro below.

  //get appropriate directories from user
  dir1 = getDirectory("Choose Source Directory ");
  dir2 = getDirectory("Choose Destination directory");
  list = getFileList(dir1);

    //give user an opportunity to adjust default parameters to better fit their application
    Dialog.create("Adjust for objective magnification");
    Dialog.addNumber("Objective Magnification (use 10 if unknown)", 10);
    Dialog.addMessage("\tIf needed particle size limits can be adjusted below \nLeave mag. at 10 if customizing particle size limits\n");
    Dialog.addNumber("Minimum particle size (pixels^2)",420);
    Dialog.addNumber("Maximum particle size (pixels^2)",1600);
    Dialog.addMessage("\tIn the following dialogs select \n first the Source Directory, \nthen a Destinaion directory for Results");
    Dialog.show();  

    //Assigning the entered values to variables   
    magnification=Dialog.getNumber();
    userMin=Dialog.getNumber();
    userMax=Dialog.getNumber();
    sMin=magnification*magnification/100*userMin;
    sMax=magnification*magnification/100*userMax;

setBatchMode(true);

for (i=0; i<list.length; i++){
    //print (list[i]);
    open(dir1+list[i]);
    name=File.nameWithoutExtension;
    //Prepare the image by removing any scale and making 8-bit
    run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel");
    run("8-bit");
    saveAs("Tiff", dir2+i+" Original "+name);//Saving with this naming scheme is required for   the MeLast macro to function
    //run("Brightness/Contrast...");
    setMinAndMax(50, 255);
    setOption("BlackBackground", false);
    run("Make Binary", "method=Yen background=Light calculate black");
    run("Watershed", "stack");
    //Analyze particles
    run("Analyze Particles...", "size="+sMin+"-"+sMax+" circularity=0.50-1.00 show=[Count Masks] display exclude include summarize");
    //Save the masks file
    saveAs("Tiff", dir2+i+" CountMask "+name);//Saving with this naming scheme is required for the MeLast macro to function
    close();
    //Save the thresholded image
    saveAs("Tiff", dir2+i+" Thresholded "+name);//Saving with this naming scheme is required for the MeLast macro to function

}
//Save the results
selectWindow("Results");
saveAs("Results", dir2+"ZZ Results.xls");

//Save the summary
selectWindow("Summary");
saveAs("Text", dir2+"Z Summary.txt");

2 Answers2

0

You need to find those clusters and analyze each to guess how many cells might belong to that cluster, using spatial information of the cells and other specific information in your problem domain. I believe that's an usual image analysis task.

As for cut-off pixel values, I guess you can consider the cut-off pixels as censored data. But I am not sure how meaningful it would be for 8 bit depth images.

Tae-Sung Shin
  • 20,215
  • 33
  • 138
  • 240
0

There is another free, open-source program called CellProfiler (http://www.cellprofiler.org) that has some more specialized methods for separating cells -- more advanced than the standard watershed. See, for example, part of the manual here: http://www.cellprofiler.org/CPmanual/IdentifyPrimaryObjects.html.

Perhaps CellProfiler can do the job, or point you to the right algorithms to bring into the ImageJ macro.

TSwayne
  • 404
  • 3
  • 11