Saving image with overlay outline

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Saving image with overlay outline

mikael.f
Hello,

I have a program which detects objects in pictures taken with a confocal microscope. After using the command "Analyze particles", I wish to save the image with the "Overlay outline". I am aware that by opening the processed picture with FIJI, the outline is found. But, is it possible to save this outline so that it can appear when the picture is not opened with FIFI?

Here is my macro:
*Get the images needed (command removed)
list = getFileList(dir1);
setBatchMode(true);
for (i=0; i<list.length; i++) {
 showProgress(i+1, list.length);
 open(dir1+list[i]);
 run("8-bit Color", "number=256");
 run("Set Scale...", "distance=0");
 run("Set Measurements...", "area mean feret's redirect=None decimal=3");
 run("Auto Threshold", "method=Otsu white");
 setOption("BlackBackground", false);
 run("Make Binary");
 run("Median...", "radius=1");
 run("Analyze Particles...", "size=2000-Infinity show=[Overlay Outlines] display exclude include add");
 x1 = getResult("FeretX",i);
 y1 = getResult("FeretY",i);
 length = getResult("Feret",i);
 degrees = getResult("FeretAngle",i);
 if (degrees>90)
    degrees -= 180;
 angle = degrees*PI/180;
 x2 = x1 + (cos(angle)*length);
 y2 = y1 - (sin(angle)*length);
 setColor("green");
 setLineWidth(3);
 drawLine(x1,y1,x2,y2);
 path_1 = dir1+list[i]+"_processed";
 saveAs("TIFF", path_1);
}
Reply | Threaded
Open this post in threaded view
|

Re: Saving image with overlay outline

Michael Schmid
Hi Mikael,

you can use Image>Overlay>Flatten to to draw the outlines into the image, modifying the pixels. If you save the resulting image, software other then ImageJ (Fiji) will see the outlines, but there is no chance to recover the original pixel value at the position of the outline (you can't hide the outline any more).

Michael
________________________________________________________________
On Jul 20, 2015, at 19:11, mikael.f wrote:

> Hello,
>
> I have a program which detects objects in pictures taken with a confocal
> microscope. After using the command "Analyze particles", I wish to save the
> image with the "Overlay outline". I am aware that by opening the processed
> picture with FIJI, the outline is found. But, is it possible to save this
> outline so that it can appear when the picture is not opened with FIFI?
>
> Here is my macro:
> *Get the images needed (command removed)
> list = getFileList(dir1);
> setBatchMode(true);
> for (i=0; i<list.length; i++) {
> showProgress(i+1, list.length);
> open(dir1+list[i]);
> run(&quot;8-bit Color&quot;, &quot;number=256&quot;);
> run(&quot;Set Scale...&quot;, &quot;distance=0&quot;);
> run(&quot;Set Measurements...&quot;, &quot;area mean feret's redirect=None
> decimal=3&quot;);
> run(&quot;Auto Threshold&quot;, &quot;method=Otsu white&quot;);
> setOption(&quot;BlackBackground&quot;, false);
> run(&quot;Make Binary&quot;);
> run(&quot;Median...&quot;, &quot;radius=1&quot;);
> run(&quot;Analyze Particles...&quot;, &quot;size=2000-Infinity
> show=[Overlay Outlines] display exclude include add&quot;);
> x1 = getResult(&quot;FeretX&quot;,i);
> y1 = getResult(&quot;FeretY&quot;,i);
> length = getResult(&quot;Feret&quot;,i);
> degrees = getResult(&quot;FeretAngle&quot;,i);
> if (degrees>90)
>    degrees -= 180;
> angle = degrees*PI/180;
> x2 = x1 + (cos(angle)*length);
> y2 = y1 - (sin(angle)*length);
> setColor("green");
> setLineWidth(3);
> drawLine(x1,y1,x2,y2);
> path_1 = dir1+list[i]+"_processed";
> saveAs("TIFF", path_1);
> }
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Saving-image-with-overlay-outline-tp5013646.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
Reply | Threaded
Open this post in threaded view
|

Re: Saving image with overlay outline

mikael.f
Thank you Michael, the program now works properly!