Hello,
I am currently trying to do some image analysis with an imageJ macro that I launch in batch mode from the command line (-batch option and setBatch(true)). After generating 68 images I would like to run the 'Images to Stack' command, to 'compile' them. Unfortunately, the stack is never generated. Any idea? Advice? Other way to do it? Anything would be greatly appreciated. Thank you, Rémi P. |
Remi,
I don't know if this is the same thing, but I recently had a problem with images created in batch mode, not being there when I exited (see my email "Batch Mode/Active Image Ambiguity" and Wayne's reply. I did an experiment using the macro shown below: setBatchMode(true); newImage("1", "8-bit Black", 100, 100, 1); newImage("2", "8-bit Black", 100, 100, 1); newImage("3", "8-bit Black", 100, 100, 1); // Point 1 //setBatchMode(false); // Point 2 run("Images to Stack"); //setBatchMode(false); If I uncomment the first "setBatchMode(false)" then images 1 and 2 aren't seen and I get the error message "There must be two images open" (image 3 is open). If I recomment that statement and uncomment the second "setBatchMode(false)", then I egt a stack with no problems. I hope this helps. David Webster On Thu, Mar 19, 2009 at 9:24 AM, Remi <[hidden email]> wrote: > Hello, > > I am currently trying to do some image analysis with an imageJ macro that I > launch in batch mode from the command line (-batch option and > setBatch(true)). After generating 68 images I would like to run the 'Images > to Stack' command, to 'compile' them. Unfortunately, the stack is never > generated. > Any idea? Advice? Other way to do it? Anything would be greatly > appreciated. > > Thank you, > > Rémi P. > |
On Friday 20 March 2009 01:25:15 David Webster wrote:
> setBatchMode(true); > newImage("1", "8-bit Black", 100, 100, 1); > newImage("2", "8-bit Black", 100, 100, 1); > newImage("3", "8-bit Black", 100, 100, 1); > // Point 1 > //setBatchMode(false); > // Point 2 > run("Images to Stack"); > //setBatchMode(false); > > If I uncomment the first "setBatchMode(false)" then images 1 and 2 aren't > seen and I get the error message "There must be two images open" (image 3 > is open). But that is correct. The documentation states that when you exit batch mode with "false", only the last selected image is shown, the others are closed. > > I am currently trying to do some image analysis with an imageJ macro that > > I launch in batch mode from the command line (-batch option and > > setBatch(true)). After generating 68 images I would like to run the > > 'Images to Stack' command, to 'compile' them. Unfortunately, the stack is > > never generated. Does it run without the batchmode? Do you by any chance have different types of images, or different sizes? cheers, G. |
Gabriel Landini wrote:
> On Friday 20 March 2009 01:25:15 David Webster wrote: > >> setBatchMode(true); >> newImage("1", "8-bit Black", 100, 100, 1); >> newImage("2", "8-bit Black", 100, 100, 1); >> newImage("3", "8-bit Black", 100, 100, 1); >> // Point 1 >> //setBatchMode(false); >> // Point 2 >> run("Images to Stack"); >> //setBatchMode(false); >> >> If I uncomment the first "setBatchMode(false)" then images 1 and 2 aren't >> seen and I get the error message "There must be two images open" (image 3 >> is open). >> > > But that is correct. The documentation states that when you exit batch mode > with "false", only the last selected image is shown, the others are closed. > > >>> I am currently trying to do some image analysis with an imageJ macro that >>> I launch in batch mode from the command line (-batch option and >>> setBatch(true)). After generating 68 images I would like to run the >>> 'Images to Stack' command, to 'compile' them. Unfortunately, the stack is >>> never generated. >>> > > Does it run without the batchmode? > Do you by any chance have different types of images, or different sizes? > > cheers, > G. > It does run without the batch mode. I think the problem is that I generate Z-axis profiles to get mean intensity values and that I can't close the graph in batch mode. So, at the end I do have different types of images: 68 I want to make a stack with and 2 Z-axis plot I can't close, even with a close(); just after their generation... Cheers, Rémi. |
In reply to this post by Gabriel Landini
Gabriel Landini wrote:
> On Friday 20 March 2009 01:25:15 David Webster wrote: > >> setBatchMode(true); >> newImage("1", "8-bit Black", 100, 100, 1); >> newImage("2", "8-bit Black", 100, 100, 1); >> newImage("3", "8-bit Black", 100, 100, 1); >> // Point 1 >> //setBatchMode(false); >> // Point 2 >> run("Images to Stack"); >> //setBatchMode(false); >> >> If I uncomment the first "setBatchMode(false)" then images 1 and 2 aren't >> seen and I get the error message "There must be two images open" (image 3 >> is open). >> > > But that is correct. The documentation states that when you exit batch mode > with "false", only the last selected image is shown, the others are closed. > > >>> I am currently trying to do some image analysis with an imageJ macro that >>> I launch in batch mode from the command line (-batch option and >>> setBatch(true)). After generating 68 images I would like to run the >>> 'Images to Stack' command, to 'compile' them. Unfortunately, the stack is >>> never generated. >>> > > Does it run without the batchmode? > Do you by any chance have different types of images, or different sizes? > > cheers, > G. > This code, with a Z-axis plot doesn't work setBatchMode(true); //Setting the autoclose options run("Profile Plot Options...", "width=450 height=200 minimum=0 maximum=0 do auto-close interpolate draw") //Creating three pictures newImage("1", "8-bit White", 500, 500, 1); newImage("2", "8-bit White", 500, 500, 1); newImage("3", "8-bit White", 500, 500, 1); //Making a stack run("Images to Stack"); print("nImages: "+nImages); print("title: "+getTitle); print("stack size: "+nSlices); //Doing some analysis run("Plot Z-axis Profile"); close(); //On ferme le plot généré par le Z-axis Profile-A //Closing the stack selectWindow("Stack"); close(); print("nImages: "+nImages); print("title: "+getTitle); print("stack size: "+nSlices); //Creating three pictures newImage("1", "8-bit White", 500, 500, 1); newImage("2", "8-bit White", 500, 500, 1); newImage("3", "8-bit White", 500, 500, 1); // ---> Impossible to make this stack <--- run("Images to Stack"); // <-- |
In reply to this post by remi-2-3
On Friday 20 March 2009 09:19:28 Remi wrote:
> It does run without the batch mode. I think the problem is that I > generate Z-axis profiles to get mean intensity values and that I can't > close the graph in batch mode. You should be able to get the title or id just after z profile creation and close() it. > So, at the end I do have different types of images: 68 I want to make a > stack with and 2 Z-axis plot I can't close, even with a close(); just after > their generation... Check that you got the name right *and* select it with selectImage(). You should be able to close it. I hope it helps G. |
In reply to this post by remi-2-3
This bug is fixed in the ImageJ 1.42l daily build. The
Image>Stacks>Plot Z-axis profile command was not working correctly in batch mode macros. -wayne On Mar 20, 2009, at 5:39 AM, Remi wrote: > Gabriel Landini wrote: >> On Friday 20 March 2009 01:25:15 David Webster wrote: >> >>> setBatchMode(true); >>> newImage("1", "8-bit Black", 100, 100, 1); >>> newImage("2", "8-bit Black", 100, 100, 1); >>> newImage("3", "8-bit Black", 100, 100, 1); >>> // Point 1 >>> //setBatchMode(false); >>> // Point 2 >>> run("Images to Stack"); >>> //setBatchMode(false); >>> >>> If I uncomment the first "setBatchMode(false)" then images 1 and 2 >>> aren't >>> seen and I get the error message "There must be two images open" >>> (image 3 >>> is open). >>> >> >> But that is correct. The documentation states that when you exit >> batch mode with "false", only the last selected image is shown, the >> others are closed. >> >> >>>> I am currently trying to do some image analysis with an imageJ >>>> macro that >>>> I launch in batch mode from the command line (-batch option and >>>> setBatch(true)). After generating 68 images I would like to run the >>>> 'Images to Stack' command, to 'compile' them. Unfortunately, the >>>> stack is >>>> never generated. >>>> >> >> Does it run without the batchmode? >> Do you by any chance have different types of images, or different >> sizes? >> >> cheers, >> G. >> > > This code, with a Z-axis plot doesn't work > > setBatchMode(true); > > //Setting the autoclose options > run("Profile Plot Options...", "width=450 height=200 minimum=0 > maximum=0 do auto-close interpolate draw") > > //Creating three pictures > newImage("1", "8-bit White", 500, 500, 1); > newImage("2", "8-bit White", 500, 500, 1); > newImage("3", "8-bit White", 500, 500, 1); > > //Making a stack > run("Images to Stack"); > > print("nImages: "+nImages); > print("title: "+getTitle); > print("stack size: "+nSlices); > > //Doing some analysis > run("Plot Z-axis Profile"); > close(); //On ferme le plot généré par le Z-axis Profile-A > > //Closing the stack > selectWindow("Stack"); > close(); > > print("nImages: "+nImages); > print("title: "+getTitle); > print("stack size: "+nSlices); > > > //Creating three pictures > newImage("1", "8-bit White", 500, 500, 1); > newImage("2", "8-bit White", 500, 500, 1); > newImage("3", "8-bit White", 500, 500, 1); > > // ---> Impossible to make this stack <--- > run("Images to Stack"); // <-- > |
Hi list,
I seem to remember there were related entries in the list (archives) here, but it seems I cannot find the right entries/keyword in the moment.... I´m working on a plugin that seems to show erratic behaviour on my new fast dual core system. I think I "nailed" the problem down to the point where I call an external plugin to do some extra processing on an internal image that I create (and usually close again after). The task here is to create a circular ROI from interferometer mask data + some hole filling . . . bProc.dilate(); bProc.dilate(); bProc.erode(); bProc.erode(); ImagePlus impb = new ImagePlus("Zygo phase mask - "+file, bProc); impb.updateAndRepaintWindow(); impb.show(); // IJ.wait(200); createSelectionFromMask(bProc); . . . . void createSelectionFromMask(ImageProcessor ip) { ip.setThreshold(0, 0, ImageProcessor.NO_LUT_UPDATE); IJ.runPlugIn("ij.plugin.filter.ThresholdToSelection", ""); } It only works if I really shortly "show" the ImagePlus impb before calling createSelectionFromMask,, OK, I can accept that, as it´s another plugin, that I use. HOWEVER, Without the added IJ.wait it seems that often on the new fast, dual core system, the other plugin already runs *BEFORE* the image is "shown", so it will cease to work. Inserting the short delay of 200-500 ms seems to cure the problem for the moment, but I wonder if there is a better solution!? Sincerely Joachim Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht Wetzlar HRB 2432 Geschäftsführer: Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy Martyr | Colin Davis ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Images are displayed in a thread separate from the thread used to run
plugins, so it would be better not to display the image until you have finished processing it. With macros, you can easily do this by running in batch mode. JavaScripts and plugins can run plugins or commands on images that are not displayed using IJ.runPlugIn(ImagePlus, className, arg) or IJ.run(ImagePlus, command, options) Here is and updated version of your example that does not display the image until it has finished: bProc.dilate(); bProc.dilate(); bProc.erode(); bProc.erode(); ImagePlus impb = new ImagePlus("Zygo phase mask - "+file, bProc); createSelectionFromMask(impb); impb.show(); . . . void createSelectionFromMask(ImagePlus imp) { ImageProcessor ip = imp.getProcessor(); ip.setThreshold(0, 0, ImageProcessor.NO_LUT_UPDATE); IJ.runPlugIn(imp, "ij.plugin.filter.ThresholdToSelection", ""); } -wayne On Mar 20, 2009, at 11:15 AM, Joachim Wesner wrote: > Hi list, > > I seem to remember there were related entries in the list (archives) > here, > but it seems I cannot find the right entries/keyword in the moment.... > > I´m working on a plugin that seems to show erratic behaviour on my new > fast > dual core system. I think I "nailed" the problem down to the > point where I call an external plugin to do some extra processing on an > internal image that I create (and usually close again after). > > The task here is to create a circular ROI from interferometer mask > data + > some hole filling > . > . > . > bProc.dilate(); bProc.dilate(); > bProc.erode(); bProc.erode(); > ImagePlus impb = new ImagePlus("Zygo phase mask - "+file, > bProc); > impb.updateAndRepaintWindow(); > impb.show(); > // IJ.wait(200); > createSelectionFromMask(bProc); > . > . > . > . > void createSelectionFromMask(ImageProcessor ip) { > ip.setThreshold(0, 0, ImageProcessor.NO_LUT_UPDATE); > IJ.runPlugIn("ij.plugin.filter.ThresholdToSelection", ""); > } > > > It only works if I really shortly "show" the ImagePlus impb before > calling > createSelectionFromMask,, OK, I can accept that, as it´s another > plugin, that I use. > > HOWEVER, > > Without the added IJ.wait it seems that often on the new fast, dual > core > system, the other plugin already runs *BEFORE* the image is "shown", > so it > will cease to work. > Inserting the short delay of 200-500 ms seems to cure the problem for > the > moment, but I wonder if there is a better solution!? > > > Sincerely > > Joachim > > > Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht > Wetzlar HRB 2432 > Geschäftsführer: Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. > David Roy > Martyr | Colin Davis > > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > |
Thanks Wayne,
again, extremely fast and exactly on the point!! Actually, I did not really want to display that temporary ImagePlus at all, but was forced to do so for the other plugin to work, as I overlooked the alternative method you mention! I changed my code and left the display of that mask window as a debug option, works great now! Thanks again! Cheers Joachim Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht Wetzlar HRB 2432 Geschäftsführer: Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy Martyr | Colin Davis ImageJ Interest Group <[hidden email]> schrieb am 20.03.2009 17:08:54: > Images are displayed in a thread separate from the thread used to run > plugins, so it would be better not to display the image until you have > finished processing it. With macros, you can easily do this by running > in batch mode. JavaScripts and plugins can run plugins or commands on > images that are not displayed using > > IJ.runPlugIn(ImagePlus, className, arg) > > or > > IJ.run(ImagePlus, command, options) > > Here is and updated version of your example that does not display the > image until it has finished: > > bProc.dilate(); bProc.dilate(); > bProc.erode(); bProc.erode(); > ImagePlus impb = new ImagePlus("Zygo phase mask - "+file, bProc); > createSelectionFromMask(impb); > impb.show(); > . > . > . > void createSelectionFromMask(ImagePlus imp) { > ImageProcessor ip = imp.getProcessor(); > ip.setThreshold(0, 0, ImageProcessor.NO_LUT_UPDATE); > IJ.runPlugIn(imp, "ij.plugin.filter.ThresholdToSelection", ""); > } > > -wayne > ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Free forum by Nabble | Edit this page |