Login  Register

Re: redirect to imageID

Posted by Du, Guanghua on May 05, 2009; 5:16pm
URL: http://imagej.273.s1.nabble.com/redirect-to-imageID-tp3692673p3692679.html

Hello, Tony,
this is exactly what I have done before, you can change the title of the
original image to filename+something to avoid conflict. and then use the
newname for redirection in the measurement.

here is a part of the code I am using.

.....................................................................

                ....................

                measuredImageTitle="IMG"+(i+1)+"Step_"+(j+1);
                rename(measuredImageTitle);
                .......................


                        // 1:  First duplicate the image, set threshold to get pixels above
the minimum intensity value (i.e. > minIntensity)
                        // 2: at the same time hen using the "find maxima" on original
subtracted image to segment the image to recognize objects (i.e.  peak
height > tolerence)
                        // 3: Then using the AND operation (threshold image AND segmented
image) to get image for object analysis such as intensity, area, center,
number. (both > minIntensity AND peak height > tolerence)
                        // 4: Finally, run the measurement (redirect the measuring image to
the original subtracted image)

                        //    ****1**** //
                        //duplicate the image,
                        selectImage(subtractedimageID);
                        duplicateIMGTitle="duplicate-0";
                        run("Duplicate...", "title="+duplicateIMGTitle);
                        duplicatesubIMGID=getImageID();
               
                        //convert the duplicated image to threshold mask
                        setThreshold(minIntensity, PixelValueMaximum);
                        run("Convert to Mask");
                        thresholdImageID=getImageID();
                        thresholdImageTitle="Threshold_"+minIntensity;
                        rename(thresholdImageTitle);
               

                        // **** 2 **** //

                               
                        //using "Find Maxima" function to segment objects,
               
                        selectImage(subtractedimageID);
                        run("Find Maxima...", "noise="+tolerencevalue+" output=[Segmented
Particles]");
                        segmentedImageID=getImageID();
                        segmentedImageTitle="Segmented_"+tolerencevalue;
                        rename(segmentedImageTitle);
               
                        // **** 3 ****//
                        imageCalculator("AND create", segmentedImageTitle,thresholdImageTitle);
                        objectImageID=getImageID();
                        objectImageTitle="IMG01_min"+minIntensity+"_PT"+tolerencevalue;
                        rename(objectImageTitle);
                       
                        // **** 4 ****//
                        //measure the area, mean gray value, max intensity, standard
deviation of the objects
                        setAutoThreshold();
                        run("Set Measurements...", "area mean center limit display
redirect="+measuredImageTitle+" decimal=2");
                        lastEntryNumber=nResults;
                        if (lastEntryNumber<0){ lastEntryNumber=0;}
                        run("Analyze Particles...", "size="+minObjectSize+"-Infinity
circularity=0.00-1.00 show=Nothing display");
                        updateResults();

       

Tony Collins wrote:

> Hi,
>
> I'm duplicating an image, then using this to create a binary/watershed mask to "analyze particles" with the measurements redirected to the original.
>
> This works well but I'd like to batch process a folder of these images. Is there a way to "redirect to" an image ID rather than image name?
>
> Thanks,
>
> Tony
>
>  
> Tony J. Collins, Ph.D.
> McMaster Biophotonics Facility
> Dept. Biochemistry and Biomedical Sciences HSC 4H21A
> McMaster University, Hamilton, ON, L8N 3Z5
> [hidden email]     www.macbiophotonics.ca

--
best wishes!
**************************************
Guanghua Du, PhD
James-Franck Str. 1
Physik Dept, E12, TUM
85748, Garching b. Muenchen
Germany

Tel:+49-89-28914286
E-mail: [hidden email]
**************************************