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 |
Hi Tony,
sorry, no way to have an ImageID for the Analyze>Set Measurements redirect target in a macro. In the inner works of ImageJ, it is an ImageID, but you cannot access it from a macro. You can only find out whether you have one, by using call("ij.plugin.filter.Analyzer.isRedirectImage"): http://rsb.info.nih.gov/ij/source/ij/plugin/filter/Analyzer.java You have to use sourceTitle = getTitle(); on the input image and set the measurement options, e.g. run("Set Measurements...", "area mean min redirect=["+ sourceTitle +"] decimal=4"); This will fail if you have two open images with the same name. Michael ________________________________________________________________ On 5 May 2009, at 17:13, 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 |
Hi,
I'm new to ImageJ. I'm trying to execute an ImageJ menu command (Import->Image Sequence) from another application. Can I run it as a command line to start ImageJ and execute the menu command? Thanks, Thai |
In reply to this post by Tony Collins-4
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] ************************************** |
In reply to this post by Michael Schmid
Hi Michael, (and thanks to Guanghua too),
Thanks for the solutions. Using the image title is a good workaround - until, as you say, you have two images open of the same name. I was hoping to avoid this as in the past I'd had trouble using titles with the image calculator menu command - but this was updated to something that could cope with Image IDs. Looking at the source code now I guess the image calculator was easier to make macro/imageID friendly... Cheers, 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 > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of > Michael Schmid > Sent: May 5, 2009 12:13 PM > To: [hidden email] > Subject: Re: redirect to imageID > > Hi Tony, > > sorry, no way to have an ImageID for the Analyze>Set Measurements > redirect target in a macro. > In the inner works of ImageJ, it is an ImageID, but you cannot access > it from a macro. You can only find out whether you have one, by using > call("ij.plugin.filter.Analyzer.isRedirectImage"): > http://rsb.info.nih.gov/ij/source/ij/plugin/filter/Analyzer.java > > You have to use > sourceTitle = getTitle(); > on the input image and set the measurement options, e.g. > run("Set Measurements...", "area mean min redirect=["+ sourceTitle > +"] decimal=4"); > > This will fail if you have two open images with the same name. > > Michael > ________________________________________________________________ > > On 5 May 2009, at 17:13, 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 |
In reply to this post by Le, Thai (NIH/NCI) [C]
> Hi,
> > I'm new to ImageJ. > I'm trying to execute an ImageJ menu command (Import->Image Sequence) > from another application. Can I run it as a command line to start > ImageJ > and execute the menu command? 1. Create a one line macro by running Import>Image Sequence with the recorder running 2. Save the macro in the ImageJ/macros folder as, say, "import.txt" 3. Run it from the command line using a command something like: java -jar /path/to/ij.jar -ijpath /path/to/ImageJ -macro import -wayne |
Thank you!
-Thai -----Original Message----- From: Rasband, Wayne (NIH/NIMH) [E] Sent: Tuesday, May 05, 2009 5:36 PM To: List IMAGEJ Subject: Re: Integration with other software > Hi, > > I'm new to ImageJ. > I'm trying to execute an ImageJ menu command (Import->Image Sequence) > from another application. Can I run it as a command line to start > ImageJ and execute the menu command? 1. Create a one line macro by running Import>Image Sequence with the recorder running 2. Save the macro in the ImageJ/macros folder as, say, "import.txt" 3. Run it from the command line using a command something like: java -jar /path/to/ij.jar -ijpath /path/to/ImageJ -macro import -wayne |
Free forum by Nabble | Edit this page |