G'day,
I'm using ImageJ 1.49o. I've written a plug-in that uses the PARALLELIZE_IMAGES flag and is designed to restrict processing to pixels with a mask defined by the user. In the run() method I use image.getRoi().getBounds() to determine mask's bounding rectangle, and ip.getRoi() to restrict processing to the strip of image assigned to the current Thread. The filter works correctly if the mask is rectangular (or the entire image). If I print the values of ip.getRoi() set for each thread I see something like the following: roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] However, if the mask is non-rectangular, I see roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] roi: java.awt.Rectangle[x=336,y=100,width=3376,height=2708] One of the threads has been passed the entire ROI. I'd expect to see roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] Is this a bug? Regards, Chris Pudney | Data Visualization Specialist R&D IS Data Sciences<http://teamspace/sites/DataSciences> | [hidden email]<mailto:[hidden email]> | R&D Blog<http://blog.pro.intra/cpudney> +61 8 9383 1278 | Datacraft Technologies, Perth, Australia (GMT+8hrs<http://www.timeanddate.com/worldclock/australia/perth>) ________________________________ Syngenta Limited, Registered in England No 2710846 Registered Office : Syngenta Limited, European Regional Centre, Priestley Road, Surrey Research Park, Guildford, Surrey, GU2 7YH, United Kingdom ________________________________ This message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Feb 16, 2015, at 10:11 PM, Pudney Chris (ext) GBJH <[hidden email]> wrote:
> > G'day, > > I'm using ImageJ 1.49o. > > I've written a plug-in that uses the PARALLELIZE_IMAGES flag and is designed to restrict processing to pixels with a mask defined by the user. All you have to do to use multiple threads and restrict processing to a non-rectangular ROI is use the PARALLELIZE_IMAGES and SUPPORTS_MASKING flags. For examples, look at the internal Convolver plugin (Process>Filters>Convolve command) at http://imagej.nih.gov/ij/source/ij/plugin/filter/Convolver.java and the Mexican Hat Filter at http://imagej.nih.gov/ij/plugins/mexican-hat/index.html > In the run() method > > I use image.getRoi().getBounds() to determine mask's bounding rectangle, and ip.getRoi() to restrict processing to the strip of image assigned to the current Thread. > > The filter works correctly if the mask is rectangular (or the entire image). If I print the values of ip.getRoi() set for each thread I see something like the following: > > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] > > However, if the mask is non-rectangular, I see > > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=2708] > > One of the threads has been passed the entire ROI. I'd expect to see > > roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] > > Is this a bug? I do not see a problem like this when I run the Mexican Hat Filter on an image with a non-rectangular ROI. -wayne > Regards, > Chris Pudney | Data Visualization Specialist -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Chris Pudney
G'day,
Thanks for your response Wayne. I wasn't aware of the SUPPORTS_MASKING flag. However, in this case I don't think it will work as we are calculating statistics related to the pixels within the mask. I've created an example (http://goo.gl/gDyxXa) that provides an example of the behaviour I described earlier. It simply counts the number of pixels within the masked region (in parallel threads). When a non-rectangular mask is defined, e.g. ellipse, then each thread reports its ROI, e.g.: ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=242] ROI: java.awt.Rectangle[x=1196,y=646,width=1548,height=242] ROI: java.awt.Rectangle[x=1196,y=888,width=1548,height=242] ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=968] <-- this is the entire ROI and the pixel count is clearly incorrect. If the mask is rectangular then I see ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=242] ROI: java.awt.Rectangle[x=1196,y=646,width=1548,height=242] ROI: java.awt.Rectangle[x=1196,y=888,width=1548,height=242] ROI: java.awt.Rectangle[x=1196,y=1130,width=1548,height=242] and the pixel count is correct. If I run the same algorithm with a single thread I see: ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=968] and the pixel count is correct. This is using ImageJ 1.49p with JRE7u43 (32-bit) on Windows 7 (64-bit). Thanks, Chris Pudney | Data Visualization Specialist | R&D IS Data Sciences Subject: Re: Bug: using PARALLELIZE_IMAGES returns incorrect ROI with non-rectangular masks From: "Rasband, Wayne (NIH/NIMH) [E]" <[hidden email]<mailto:[hidden email]>> Reply-To: [hidden email]<mailto:[hidden email]> Date: Wed, 18 Feb 2015 02:50:36 +0000 On Feb 16, 2015, at 10:11 PM, Pudney Chris (ext) GBJH <[hidden email]<mailto:[hidden email]>> wrote: > > G'day, > > I'm using ImageJ 1.49o. > > I've written a plug-in that uses the PARALLELIZE_IMAGES flag and is designed to restrict processing to pixels with a mask defined by the user. All you have to do to use multiple threads and restrict processing to a non-rectangular ROI is use the PARALLELIZE_IMAGES and SUPPORTS_MASKING flags. For examples, look at the internal Convolver plugin (Process>Filters>Convolve command) at http://imagej.nih.gov/ij/source/ij/plugin/filter/Convolver.java and the Mexican Hat Filter at http://imagej.nih.gov/ij/plugins/mexican-hat/index.html > In the run() method > > I use image.getRoi().getBounds() to determine mask's bounding rectangle, and ip.getRoi() to restrict processing to the strip of image assigned to the current Thread. > > The filter works correctly if the mask is rectangular (or the entire image). If I print the values of ip.getRoi() set for each thread I see something like the following: > > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] > > However, if the mask is non-rectangular, I see > > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=2708] > > One of the threads has been passed the entire ROI. I'd expect to see > > roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] > > Is this a bug? I do not see a problem like this when I run the Mexican Hat Filter on an image with a non-rectangular ROI. -wayne > Regards, > Chris Pudney | Data Visualization Specialist -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html ________________________________ Syngenta Limited, Registered in England No 2710846 Registered Office : Syngenta Limited, European Regional Centre, Priestley Road, Surrey Research Park, Guildford, Surrey, GU2 7YH, United Kingdom ________________________________ This message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Chris,
the culprit in your code is ImagePlus.getMask(); it restores the roi of the ImageProcessor associated with an ImagePlus. This affects the last thread, which uses the original ImageProcessor, just with a temporarily modified Roi rectangle. Anyhow, I think that the PARALLELIZE_IMAGES flag is for *processing* images; it was not meant for something like statistics. What is the statistics-like operation that you have in mind, where processing time would be so much of an issue that you need parallelization? Michael _____________________________________________________________________ On Tue, March 3, 2015 09:33, Pudney Chris (ext) GBJH wrote: > G'day, > > Thanks for your response Wayne. > > I wasn't aware of the SUPPORTS_MASKING flag. However, in this case I don't > think it will work as we are calculating statistics related to the pixels > within the mask. > > I've created an example (http://goo.gl/gDyxXa) that provides an example of > the behaviour I described earlier. It simply counts the number of pixels > within the masked region (in parallel threads). > > When a non-rectangular mask is defined, e.g. ellipse, then each thread > reports its ROI, e.g.: > > ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=242] > ROI: java.awt.Rectangle[x=1196,y=646,width=1548,height=242] > ROI: java.awt.Rectangle[x=1196,y=888,width=1548,height=242] > ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=968] <-- this is > the entire ROI > > and the pixel count is clearly incorrect. If the mask is rectangular then > I see > > ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=242] > ROI: java.awt.Rectangle[x=1196,y=646,width=1548,height=242] > ROI: java.awt.Rectangle[x=1196,y=888,width=1548,height=242] > ROI: java.awt.Rectangle[x=1196,y=1130,width=1548,height=242] > > and the pixel count is correct. > > If I run the same algorithm with a single thread I see: > > ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=968] > > and the pixel count is correct. > > This is using ImageJ 1.49p with JRE7u43 (32-bit) on Windows 7 (64-bit). > > Thanks, > Chris Pudney | Data Visualization Specialist | R&D IS Data Sciences > > Subject: Re: Bug: using PARALLELIZE_IMAGES returns incorrect ROI with > non-rectangular masks > From: "Rasband, Wayne (NIH/NIMH) [E]" > <[hidden email]<mailto:[hidden email]>> > Reply-To: [hidden email]<mailto:[hidden email]> > Date: Wed, 18 Feb 2015 02:50:36 +0000 > > On Feb 16, 2015, at 10:11 PM, Pudney Chris (ext) GBJH > <[hidden email]<mailto:[hidden email]>> wrote: >> >> G'day, >> >> I'm using ImageJ 1.49o. >> >> I've written a plug-in that uses the PARALLELIZE_IMAGES flag and is >> designed to restrict processing to pixels with a mask defined by the >> user. > > All you have to do to use multiple threads and restrict processing to a > non-rectangular ROI is use the PARALLELIZE_IMAGES and SUPPORTS_MASKING > flags. For examples, look at the internal Convolver plugin > (Process>Filters>Convolve command) at > > http://imagej.nih.gov/ij/source/ij/plugin/filter/Convolver.java > > and the Mexican Hat Filter at > > http://imagej.nih.gov/ij/plugins/mexican-hat/index.html > >> In the run() method >> >> I use image.getRoi().getBounds() to determine mask's bounding rectangle, >> and ip.getRoi() to restrict processing to the strip of image assigned to >> the current Thread. >> >> The filter works correctly if the mask is rectangular (or the entire >> image). If I print the values of ip.getRoi() set for each thread I see >> something like the following: >> >> roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] >> roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] >> roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] >> roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] >> >> However, if the mask is non-rectangular, I see >> >> roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] >> roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] >> roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] >> roi: java.awt.Rectangle[x=336,y=100,width=3376,height=2708] >> >> One of the threads has been passed the entire ROI. I'd expect to see >> >> roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] >> >> Is this a bug? > > I do not see a problem like this when I run the Mexican Hat Filter on an > image with a non-rectangular ROI. > > -wayne > > >> Regards, >> Chris Pudney | Data Visualization Specialist > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > ________________________________ > Syngenta Limited, Registered in England No 2710846 > Registered Office : Syngenta Limited, European Regional Centre, Priestley > Road, Surrey Research Park, Guildford, Surrey, GU2 7YH, United Kingdom > ________________________________ > This message may contain confidential information. If you are not the > designated recipient, please notify the sender immediately, and delete the > original and any copies. Any use of the message by you is prohibited. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Chris Pudney
On Mar 3, 2015, at 3:33 AM, Pudney Chris (ext) GBJH <[hidden email]> wrote:
> > G’day, > > Thanks for your response Wayne. > > I wasn’t aware of the SUPPORTS_MASKING flag. However, in this case I don’t think it will work as we are calculating statistics related to the pixels within the mask. Thanks to Michael Schmid, this bug is fixed in the latest ImageJ daily build (1.49q1). -wayne > I’ve created an example (http://goo.gl/gDyxXa) that provides an example of the behaviour I described earlier. It simply counts the number of pixels within the masked region (in parallel threads). > > > > When a non-rectangular mask is defined, e.g. ellipse, then each thread reports its ROI, e.g.: > > > > ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=242] > > ROI: java.awt.Rectangle[x=1196,y=646,width=1548,height=242] > > ROI: java.awt.Rectangle[x=1196,y=888,width=1548,height=242] > > ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=968] <-- this is the entire ROI > > > > and the pixel count is clearly incorrect. If the mask is rectangular then I see > > > > ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=242] > > ROI: java.awt.Rectangle[x=1196,y=646,width=1548,height=242] > > ROI: java.awt.Rectangle[x=1196,y=888,width=1548,height=242] > > ROI: java.awt.Rectangle[x=1196,y=1130,width=1548,height=242] > > > > and the pixel count is correct. > > > > If I run the same algorithm with a single thread I see: > > > > ROI: java.awt.Rectangle[x=1196,y=404,width=1548,height=968] > > > > and the pixel count is correct. > > > > This is using ImageJ 1.49p with JRE7u43 (32-bit) on Windows 7 (64-bit). > > > > Thanks, > > Chris Pudney | Data Visualization Specialist | R&D IS Data Sciences > > > > Subject: Re: Bug: using PARALLELIZE_IMAGES returns incorrect ROI with non-rectangular masks > > From: "Rasband, Wayne (NIH/NIMH) [E]" <[hidden email]> > > Reply-To: [hidden email] > > Date: Wed, 18 Feb 2015 02:50:36 +0000 > > > > On Feb 16, 2015, at 10:11 PM, Pudney Chris (ext) GBJH <[hidden email]> wrote: > > > > > > G'day, > > > > > > I'm using ImageJ 1.49o. > > > > > > I've written a plug-in that uses the PARALLELIZE_IMAGES flag and is designed to restrict processing to pixels with a mask defined by the user. > > > > All you have to do to use multiple threads and restrict processing to a non-rectangular ROI is use the PARALLELIZE_IMAGES and SUPPORTS_MASKING flags. For examples, look at the internal Convolver plugin (Process>Filters>Convolve command) at > > > > http://imagej.nih.gov/ij/source/ij/plugin/filter/Convolver.java > > > > and the Mexican Hat Filter at > > > > http://imagej.nih.gov/ij/plugins/mexican-hat/index.html > > > > > In the run() method > > > > > > I use image.getRoi().getBounds() to determine mask's bounding rectangle, and ip.getRoi() to restrict processing to the strip of image assigned to the current Thread. > > > > > > The filter works correctly if the mask is rectangular (or the entire image). If I print the values of ip.getRoi() set for each thread I see something like the following: > > > > > > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] > > > roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] > > > roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] > > > roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] > > > > > > However, if the mask is non-rectangular, I see > > > > > > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=677] > > > roi: java.awt.Rectangle[x=336,y=777,width=3376,height=677] > > > roi: java.awt.Rectangle[x=336,y=1454,width=3376,height=677] > > > roi: java.awt.Rectangle[x=336,y=100,width=3376,height=2708] > > > > > > One of the threads has been passed the entire ROI. I'd expect to see > > > > > > roi: java.awt.Rectangle[x=336,y=2131,width=3376,height=677] > > > > > > Is this a bug? > > > > I do not see a problem like this when I run the Mexican Hat Filter on an image with a non-rectangular ROI. > > > > -wayne > > > > > > > Regards, > > > Chris Pudney | Data Visualization Specialist > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > Syngenta Limited, Registered in England No 2710846 > Registered Office : Syngenta Limited, European Regional Centre, Priestley Road, Surrey Research Park, Guildford, Surrey, GU2 7YH, United Kingdom > This message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hello. I received two bug reports this week saying FracLac worked one day but not the next and I tried it myself and it indeed crashes in IJ1.49p but not 1.49o. Any ideas where to start looking?
-- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Mar 5, 2015, at 18:46, audrey karperien wrote:
> Hello. I received two bug reports this week saying FracLac worked one day but not the next and I tried it myself and it indeed crashes in IJ1.49p but not 1.49o. Any ideas where to start looking? Hi Audrey, the first thing to answer is what "crash" means. If it is an exception, the stack trace will usually give you some information. Some exceptions can be silent, e.g. if the code in in the EventQueue (java awt callbacks, e.g. mouseMoved, actionPerformed etc.). Put try-catch around this code and IJ.handleException(e) to see the exception. If ImageJ crashes as a whole, it is a bug in Java - usually very difficult to diagnose. Usually there will be a log file of the crash (its location depends on the operating system). On Mac OSX 10.6, open Applications>Utilities>Console, and look at DIAGNOSITC AND USAGE INFO>User Diagnostic Reports. -- To see the changes between ImageJ 1.49p and 1.49o, you can have a look at https://github.com/imagej/imagej1/commits/master/ij but they are many. If there are components of ImageJ that you suspect, find the respective source file at https://github.com/imagej/imagej1/tree/master/ij and press the 'History' button to see when it was changed. Michael -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thanks Michael and Wayne for your speedy help.
It turns out that the bugs were actually not related to the ImageJ upgrade, but are FracLac-specific, and just happened to be reported at the same time I upgraded ImageJ. Thanksn again,Audrey From: Michael Schmid <[hidden email]> To: [hidden email] Sent: Thursday, March 5, 2015 1:13 PM Subject: Re: plugin error On Mar 5, 2015, at 18:46, audrey karperien wrote: > Hello. I received two bug reports this week saying FracLac worked one day but not the next and I tried it myself and it indeed crashes in IJ1.49p but not 1.49o. Any ideas where to start looking? Hi Audrey, the first thing to answer is what "crash" means. If it is an exception, the stack trace will usually give you some information. Some exceptions can be silent, e.g. if the code in in the EventQueue (java awt callbacks, e.g. mouseMoved, actionPerformed etc.). Put try-catch around this code and IJ.handleException(e) to see the exception. If ImageJ crashes as a whole, it is a bug in Java - usually very difficult to diagnose. Usually there will be a log file of the crash (its location depends on the operating system). On Mac OSX 10.6, open Applications>Utilities>Console, and look at DIAGNOSITC AND USAGE INFO>User Diagnostic Reports. -- To see the changes between ImageJ 1.49p and 1.49o, you can have a look at https://github.com/imagej/imagej1/commits/master/ij but they are many. If there are components of ImageJ that you suspect, find the respective source file at https://github.com/imagej/imagej1/tree/master/ij and press the 'History' button to see when it was changed. Michael -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |