alternative to doWand(x,y)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

alternative to doWand(x,y)

chepe santacruz
I am trying to analyze images of lung samples and in order to get the
measurements of a particular alveolar i use the imageJ "doWand(x,y)"
method to select it(the image is converted to a black and white version
beforehand) then i get it's roi. In order to do this i have to open the
image and show it on the
screen.
Is there a way to select a region without opening the image on the screen? I
tried to use the ImageProcessor and manipulate it's pixel array but there is
no way to select a region.

Would anyone have a solution?

-----------------------------------------
Billy Bustillo
McGill University Meakins Laboratories
Montreal, Canada
Reply | Threaded
Open this post in threaded view
|

Re: alternative to doWand(x,y)

Albert Cardona
Chepe,

There is no need to have the images visible in the screen to do whatever on
them. In this case, you can open the image from a plugin and execute the
doWand(x,y) on it without ever showing the image:

// open and set active
ImagePlus imp = new Opener().openImage("/path/to/image.tif");
if (null == imp) return;
WindowManager.setTempCurrentImage(imp);

// analyze
IJ.doWand(x, y);
IJ.run("Measure");


// If you would like to put in any other kind of ROI, simply create it (it's
an object) and add it to the ImagePlus:

int[] xpoints = new int[]{0, 100, 100, 0};
int[] ypoints = new int[]{0, 0, 100, 100};
Roi roi = new PolygonRoi(xpoints, ypoints, xpoints.length, Roi.POLYGON);
imp.setRoi(roi);
IJ.run("Measure");

// And don't forget to cleanup after being finished with the image!

// cleanup
imp.flush();
WindowManager.setTempCurrentImage(null);



Albert

--
Albert Cardona
Molecular Cell Developmental Biology
University of California Los Angeles
Tel +1 310 2067376
Programming: http://www.pensament.net/java/
Research: http://www.mcdb.ucla.edu/Research/Hartenstein/
Web design: http://www.pixelets.com