Posted by
Robert Dougherty on
URL: http://imagej.273.s1.nabble.com/Where-is-result-image-of-calculate-tp3701646p3701650.html
John,
The ImagePlus img3 = WindowManager.getCurrentImage(); statement would
not take very long. If it is a thousand cycles, that is still less than
a microsecond. A bigger problem would be running out of memory if you
don't close the three windows you open in the loop. Another issue is
that "Threshold" does not seem to be an ImageCalculator option, so
finding the ImagePlus created by the "Subtract create" may not be
helpful, at least not for running the threshold operation. Maybe you
want something like this:
ImageCalculator ic = new ImageCalculator();
for (int i=0; i<fileList.length; i++) {
ImagePlus img1 = new Opener().openImage(dir1, fileList[i]);
ImagePlus img2 = new Opener().openImage(dir1, bkgrdImgFile);
ic.calculate("Subtract create", img1, img2);
//ic.calculate("Threshold", /* result of subtract? */ );
int ll = ... something...;
int ul = ... something...;
//(it might be helpful to do
// ImagePlus img3 = WindowManager.getCurrentImage();
//to help establish ll and ul
IJ.setThreshold(ll, ul);
IJ.run("Threshold", "thresholded remaining black");
ImagePlus imgResult = WindowManager.getCurrentImage();
...do something with imgResult...;
imgResult.hide();
Img1.hide();
Img2.hide();
}
I don't understand the question about running the program from the
command line. Is your code not an ImageJ plugin? If you are running
ImageJ from the command line, what difference does that make?
Bob
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of
John
> Kim
> Sent: Monday, September 04, 2006 9:50 PM
> To:
[hidden email]
> Subject: Re: Where is result image of calculate()?
>
> Bob wrote:
> > I suggest
> > ImagePlus img3 = WindowManager.getCurrentImage();
>
> Thanks Bob but...
>
> I was hoping to be able to call the program from command line. Will
this
> still work? Even if it does, I think it'll slow down the program. I'm
> trying to process thousands of images.
>
> John