Edge Enhancement

Posted by Sidnei Paciornik on
URL: http://imagej.273.s1.nabble.com/Edge-Enhancement-tp5003576p5014753.html

Hi Gabriel
Thanks for the patience. I have just confirmed it is a memory error. Actually, I
should have noticed it right away as the macro error bar shows exactly that ( OutOfMemoryError: Java heap space) .
But it is still a bit confusing.
The original image is 8-bit, 15591 x 18643 pixels , totalling 277 Mb of memory. I did duplicate it twice, as you suggested, and
we have no problem.
The computer has a total of 24 Gigabytes of RAM. We have 18 Gigabytes allocated
in the Memory option for FIJI. Thus, if your code only uses 3 times the image
memory size, we should be far away from our limits.
However, following FIJI´s memory allocation in the Process Manager, I noticed it
uses a lot of memory. Actually, it grows BEYOND the 18 gig we had allocated,
what is already weird. It peaked a bit above 19 Gig.
We did test the same conditions in a much faster double Xeon with 96 gigabytes
of RAM and the code runs correctly.
So I guess the points are: 1) Why does the code (which I attach at the end of this message) use so much
memory. 2) How can FIJI use more memory that is allocated to it.
Thank you again. Prof. Sidnei Paciornik Grupo de Análise de Imagens e Microscopia Digital
DEQM - Departamento de Engenharia Química e de Materiais
PUC-Rio

Rua Marquês de São Vicente 225
Prédio Leme, Sala 501L
Gávea - Rio de Janeiro - RJ
22451-900 - Brasil
tel: (55) (21)3527-1243
Code follows: //setBatchMode(true);
if (bitDepth()!=24){ a=getTitle(); Dialog.create(“Morphologica Contrast Thr”); Dialog.addNumber(“Radius”, 2); Dialog.addNumber(“Threshold”, 25); Dialog.show(); r=Dialog.getNumber(); t=Dialog.getNumber();
run(“Duplicate...”, “title=min”); run(“Minimum...”, “radius=”+r); selectWindow(a); run(“Duplicate...”, “title=max”); run(“Maximum...”, “radius=”+r);
selectWindow(“max”); w=getWidth(); h=getHeight(); i=0; max=newArray(w*h); for (x=0;x<w;x++){ for (y=0;y<h;y++){ max[i]=getPixel(x,y); i++; } }

selectWindow(“min”); i=0; min=newArray(w*h); for (x=0;x<w;x++){ for (y=0;y<h;y++){ min[i]=getPixel(x,y); i++; } }
selectWindow(a); i=0; for (x=0;x<w;x++){ for (y=0;y<h;y++){ c=getPixel(x,y); if (max[i]-min[i]>t){ if((max[i]-c)<=(c-min[i])){ putPixel(x,y, max[i]); } else if ((max[i]-c)>(c-min[i])){ putPixel(x,y, min[i]); } } i++; } } updateDisplay(); selectWindow(“min”); close(); selectWindow(“max”); close(); } else showMessage(“Error”,” Greyscale images only!\nConvert RGB to HSB and process\nthe Brightness channel
only.”);
setBatchMode(false);
//---------------8<----------- ------


On Fri, Oct 23, 2015 at 2:34 PM, Gabriel Landini < [hidden email] > wrote:
On Friday 23 Oct 2015 16:01:34 you wrote:
> Hi Gabriel
> Thanks for the feedback.
> We did remove the line but it did not help. I know it looks like a memory
> problem but, if so, shouldn´t there be some kind of error message?
> Any other suggestions?

Open the image to process. Then duplicate it, then duplicate it again (so 3
images of the same size are open. If you run out of memory with that, then
that is the cause of the problem.

Can you send me the macro you are using, and tell me the size of the image
(and the amount of ram allocated to IJ).
Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html