hi all,
I'm creating a selection from auto threshold of a 541MB picture on late 2012 iMac, 32Gb (4x8) i7 processor (using Fiji, but it's the same in Ij2 or Ij1). I increased memory to 20G in options menu and in plist.txt. It takes over 20 minutes to do this. Is this normal?? I added a print screen while the create selection is running. Thx in advance! |
Hi VC,
well, I don't have a computer system as powerful as yours, but I can imagine that an image of such a large size can need a long time for 'Create Selection' if it has many small particles. On my computer, 'Create Selection' with the 'Particles' sample image replicated 2x2 times (4000x2000 pxl) needs about 1.8 sec, but when replicated 4x4 times (8000x4000 pxl) it needs 34 sec. So there is some overhead that grows roughly with the square of the image size (or the number of particles). The progress indicator needs only a small portion of that time. Looking at the source code of ThresholdToSelection.java, I guess that the computing time is probably spent in the java.awt.geom.GeneralPath.append method: It is not based on pixels but on outlines, which may have double precision accuracy. When adding any new particle (outline) to it, it has to check thousands of other particles (polygons) whether they might touch or intersect. The computing time for it will be proportional to the square of the number of particles; for my case with ≈160000 particles that's about 10^10 tests. Even if these checks are done efficiently (checking the bounding rectangles only) this will take some time. In principle, this check is not necessary, but as far as I know one cannot avoid doing this check (also the new Java 1.6 Path2D methods do not help). --- I also tried to deselect all options in 'Set Measurements' and 'Analyze Particles' with adding to the ROI Manager. This takes less than 7 seconds for the 8000x4000 pxl image. However, combining all the 160000 ROIs takes ages (I finally 'killed' ImageJ because I did not want to wait for hours), so don't try this as a way out! --- The bottom line: if you have images with >100000 particles (or fewer in some cases), avoid selecting all particles at once. Rather use a mask and do operations with it. Alternatively, use 'Limit to threshold' in 'Set Measurements'. On the long term, if problems like this should be more common, one should consider a mask-based ROI type. Maybe the ImageJ2 developers read this... Michael ________________________________________________________________ On Dec 9, 2013, at 16:17, VC wrote: > hi all, > > I'm creating a selection from auto threshold of a 541MB picture on late 2012 > iMac, 32Gb (4x8) i7 processor (using Fiji, but it's the same in Ij2 or Ij1). > I increased memory to 20G in options menu and in plist.txt. > > > It takes over 20 minutes to do this. Is this normal?? > > I added a print screen while the create selection is running. > > Thx in advance! > > <http://imagej.1557.x6.nabble.com/file/n5005856/fiji.jpg> > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/is-this-normal-tp5005856.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Michael,
> On the long term, if problems like this should be more common, one > should consider a mask-based ROI type. Maybe the ImageJ2 developers > read this... Indeed, the approach to ROIs in ImgLib2 (and hence ImageJ2) is to have all ROIs extend the same base RegionOfInterest interface. This includes shape-based ROIs, but also thresholds and masks. That said, please note that the ROI & Overlay type hierarchies are one of the less-solid things in ImageJ2 right now; they still need a few more design iterations. Regards, Curtis On Tue, Dec 10, 2013 at 11:10 AM, Michael Schmid <[hidden email]>wrote: > Hi VC, > > well, I don't have a computer system as powerful as yours, but I can > imagine that an image of such a large size can need a long time for 'Create > Selection' if it has many small particles. > > On my computer, 'Create Selection' with the 'Particles' sample image > replicated 2x2 times (4000x2000 pxl) needs about 1.8 sec, but when > replicated 4x4 times (8000x4000 pxl) it needs 34 sec. So there is some > overhead that grows roughly with the square of the image size (or the > number of particles). The progress indicator needs only a small portion of > that time. > > Looking at the source code of ThresholdToSelection.java, I guess that the > computing time is probably spent in the java.awt.geom.GeneralPath.append > method: It is not based on pixels but on outlines, which may have double > precision accuracy. When adding any new particle (outline) to it, it has > to check thousands of other particles (polygons) whether they might touch > or intersect. The computing time for it will be proportional to the square > of the number of particles; for my case with ≈160000 particles that's about > 10^10 tests. Even if these checks are done efficiently (checking the > bounding rectangles only) this will take some time. In principle, this > check is not necessary, but as far as I know one cannot avoid doing this > check (also the new Java 1.6 Path2D methods do not help). > > --- > > I also tried to deselect all options in 'Set Measurements' and 'Analyze > Particles' with adding to the ROI Manager. This takes less than 7 seconds > for the 8000x4000 pxl image. However, combining all the 160000 ROIs takes > ages (I finally 'killed' ImageJ because I did not want to wait for hours), > so don't try this as a way out! > > --- > > The bottom line: if you have images with >100000 particles (or fewer in > some cases), avoid selecting all particles at once. Rather use a mask and > do operations with it. Alternatively, use 'Limit to threshold' in 'Set > Measurements'. > > On the long term, if problems like this should be more common, one should > consider a mask-based ROI type. Maybe the ImageJ2 developers read this... > > > Michael > ________________________________________________________________ > On Dec 9, 2013, at 16:17, VC wrote: > > > hi all, > > > > I'm creating a selection from auto threshold of a 541MB picture on late > 2012 > > iMac, 32Gb (4x8) i7 processor (using Fiji, but it's the same in Ij2 or > Ij1). > > I increased memory to 20G in options menu and in plist.txt. > > > > > > It takes over 20 minutes to do this. Is this normal?? > > > > I added a print screen while the create selection is running. > > > > Thx in advance! > > > > <http://imagej.1557.x6.nabble.com/file/n5005856/fiji.jpg> > > > > > > > > -- > > View this message in context: > http://imagej.1557.x6.nabble.com/is-this-normal-tp5005856.html > > Sent from the ImageJ mailing list archive at Nabble.com. > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > 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 |