Hi everyone;
Using ImageJ to calculate the image stats from a huge virtual stack (around a 1 GB ) I noticed that the plugin used for calculating (Stack_Statistics) is quite slow for my purpose so I implemented my own solution using threads. This solution is around 4 times faster but still slow. Have a few ideas about how to do it but I feel like reinventing the wheel so if someone has any idea please let me know. Best Regards.
Research engineer
HGGM. Madrid. |
Hi Peter,
if your data are in a 1 GB virtual stack, I guess that the time for computing the ImageStatistics is usually dominated by the time for loading the files from disk (unless you have an SSD or a lot of RAM and/or a hybrid disk *and* the data are already in the disk cache). If running the ImageStatistics in a threads makes it faster, the first thing to check is whether you have set only those measurement options (e.g. MEAN, STD_DEV, MODE, MIN_MAX) that you actually need. If you don't need any data that are based on the histogram and you have no ROI (i.e., you want statistics on the whole image), it may be faster not to use the ImageJ ImageStatistics. In that case, you can try to get the pixels arrays of the stack and do the min, max, averaging or whatever you want by a loop over the pixels. Of course, to have it generally applicable you have to write your code four times, for 8-bit, 16-bit, float, and RGB images. And then you should probably care about 8-bit or 16-bit images with a calibration table (if it is nonlinear, note that e.g. the calibrated value of the raw pixel mean is not the mean of the calibrated values). When keeping all that in mind, you will soon have rather complex code, and I am not sure whether it will be much faster than the ImageJ built-in ImageStatistics (ByteStatistics, ShortStatistics, etc.) So far my 3 cents, Michael ________________________________________________________________ On Apr 28, 2014, at 13:40, Peter Mc wrote: > Hi everyone; > > Using ImageJ to calculate the image stats from a huge virtual stack (around > a 1 GB ) I noticed that the plugin used for calculating (Stack_Statistics) > is quite slow for my purpose so I implemented my own solution using > threads. This solution is around 4 times faster but still slow. > > Have a few ideas about how to do it but I feel like reinventing the wheel so > if someone has any idea please let me know. > > Best Regards. > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Faster-way-to-get-statistics-from-an-image-tp5007465.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; Sorry I forget to say, the images are in a monstrous server placed in the place I work I realized that the access to data was the problem so I divide the raw data in a few fragments, that is the way I get a faster implementation. by the way, how exactly set the needed measurements by code?
Thank you. Best Regards. On 28 April 2014 18:57, Michael Schmid-3 [via ImageJ] <[hidden email]> wrote: Hi Peter, "Ver cómo pasan los días, y los años…, sin que nada cambie. Ayer mismo éramos tú y yo dos críos que veníamos a fumar aquí, a escondidas, los primeros pitillos… ¡Y hace ya diez años! Hemos crecido sin darnos cuenta, subiendo y bajando la escalera, rodeados siempre de los padres, que no nos entienden; de vecinos que murmuran de nosotros y de quienes murmuramos…"
Historia de una escalera - Antonio Buero Vallejo
Research engineer
HGGM. Madrid. |
Free forum by Nabble | Edit this page |