Automatically define and set particular regions of "grey" to 255

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

Automatically define and set particular regions of "grey" to 255

Emmanuel Levy
Dear All,

I'm quite new to image processing. I feel the problem I face is quite
simple but I'm not sure about which direction to take, so any
suggestion would be highly appreciated.

Basically, in the image attached, I would like to set the background
regions (i.e., regions with no cell) to 255. One could easily do this
by hand using a "Magic Wand" for example, but I'm not sure which way
would be best in batch mode.

I guess the criteria that have to be met by those regions are:
- be larger than X pixels
- be a concav polygon

Any idea on how best to implement this in ImageJ?
Thanks,

Emmanuel

EL_ImageToProcess2.png (427K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Automatically define and set particular regions of "grey" to 255

Crowell Elizabeth
Hello Emmanuel,

If I understand what you are trying to do, I think the Image Math
function might be a good way to accomplish this.
Go to Process/Math/Macro... and enter the following expression:
if((v<10)) v=255;
This will have the effect of setting every pixel whose value is less
than 10 to the value of 255.

Of course, this method will also change the pixel values inside your
circular objects (looks like budding yeast!), since they are
indistinguishable from the background by their pixel values.
However, by thresholding and converting to binary, you can use
Process/Binary/Fill Holes to remove the dark spaces inside your objects
and segment them separately.

In any case, you probably need to do some mild background subtraction or
smoothing to improve your image before doing any segmentation.  There
are a few background pixels with higher values (probably noise) - this
problem can be eliminated by applying a Gaussian blur of 0.5 pixel
radius, for example (Process/Filters/Gaussian blur...).

In order to incorporate this kind of processing in a macro to run on a
series of images in batch mode, you can simply record the actions to
retrieve the code (Plugins/Macros/Record...).

Does this answer your question?

Kind Regards,
Elizabeth Crowell


Emmanuel Levy a écrit :

> Dear All,
>
> I'm quite new to image processing. I feel the problem I face is quite
> simple but I'm not sure about which direction to take, so any
> suggestion would be highly appreciated.
>
> Basically, in the image attached, I would like to set the background
> regions (i.e., regions with no cell) to 255. One could easily do this
> by hand using a "Magic Wand" for example, but I'm not sure which way
> would be best in batch mode.
>
> I guess the criteria that have to be met by those regions are:
> - be larger than X pixels
> - be a concav polygon
>
> Any idea on how best to implement this in ImageJ?
> Thanks,
>
> Emmanuel
>  
>
> ------------------------------------------------------------------------
>


--

Elizabeth CROWELL

----------------------------------------------------------------------
Membrane Traffic and Cell Division Research Group
Institut Pasteur
28 rue du Dr Roux
75015 PARIS, France

Tel :  01.44.38.94.07
Fax : 01.45.68.89.54
----------------------------------------------------------------------


part1.09030908.07000704@pasteur.fr (428K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Automatically define and set particular regions of "grey" to 255

Crowell Elizabeth
In reply to this post by Emmanuel Levy
Hello Emmanuel,

I tried to send this message a minute ago, and apparently there was a
bug and it doesn't seem to have gone through!

If I understand what you are trying to do, I think the Image Math
function might be a good way to accomplish this.
Go to Process/Math/Macro... and enter the following expression:
if((v<10)) v=255;
This will have the effect of setting every pixel whose value is less
than 10 to the value of 255.

Of course, this method will also change the pixel values inside your
circular objects (looks like budding yeast!), since they are
indistinguishable from the background by their pixel values.
However, by thresholding and converting to binary, you can use
Process/Binary/Fill Holes to remove the dark spaces inside your objects
and segment them separately.

In any case, you probably need to do some mild background subtraction or
smoothing to improve your image before doing any segmentation.  There
are a few background pixels with higher values (probably noise) - this
problem can be eliminated by applying a Gaussian blur of 0.5 pixel
radius, for example (Process/Filters/Gaussian blur...).

In order to incorporate this kind of processing in a macro to run on a
series of images in batch mode, you can simply record the actions to
retrieve the code (Plugins/Macros/Record...).

Does this answer your question?

Kind Regards,
Elizabeth Crowell



Emmanuel Levy a écrit :

> Dear All,
>
> I'm quite new to image processing. I feel the problem I face is quite
> simple but I'm not sure about which direction to take, so any
> suggestion would be highly appreciated.
>
> Basically, in the image attached, I would like to set the background
> regions (i.e., regions with no cell) to 255. One could easily do this
> by hand using a "Magic Wand" for example, but I'm not sure which way
> would be best in batch mode.
>
> I guess the criteria that have to be met by those regions are:
> - be larger than X pixels
> - be a concav polygon
>
> Any idea on how best to implement this in ImageJ?
> Thanks,
>
> Emmanuel
>  
>
> ------------------------------------------------------------------------
>
>


--

Elizabeth CROWELL

----------------------------------------------------------------------
Membrane Traffic and Cell Division Research Group
Institut Pasteur
28 rue du Dr Roux
75015 PARIS, France

Tel :  01.44.38.94.07
Fax : 01.45.68.89.54
----------------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Automatically define and set particular regions of "grey" to 255

Nathaniel Ryckman
In reply to this post by Emmanuel Levy
I think everyone feels that their problem is quite simple ;-). Apparently, there aren't very good solutions to cellular image analysis from what I can tell.

A quick way to get a close approximation for what you want goes as follows:

1) Download the autothreshold package from Fiji.
2) Process -> Subtract background -> 50px and sliding paraboloid (Helps correct for noise/uneven lighting)
3) Image->Adjust->Autothreshold -> MinError(l) -> White objects... and SetThreshold instead of..
4) Image->Adjust->Threshold->Apply
5) Process->Noise->Despeckle
6) Edit->Invert
7) Analyze->Analyze Particles->700-Infinity (pixels) and add to manager
8) Select all your ROI's and click measure. You can export the table to an excel sheet from there.
Reply | Threaded
Open this post in threaded view
|

Re: Automatically define and set particular regions of "grey" to 255

Nathaniel Ryckman
In reply to this post by Emmanuel Levy
Emmanuel Levy wrote
Dear All,

I'm quite new to image processing. I feel the problem I face is quite
simple but I'm not sure about which direction to take, so any
suggestion would be highly appreciated.

Basically, in the image attached, I would like to set the background
regions (i.e., regions with no cell) to 255. One could easily do this
by hand using a "Magic Wand" for example, but I'm not sure which way
would be best in batch mode.

I guess the criteria that have to be met by those regions are:
- be larger than X pixels
- be a concav polygon

Any idea on how best to implement this in ImageJ?
Thanks,

Emmanuel
Oops! I thought you wanted to measure the background. You can then write a small macro to fill in the ROI's instead.

run("Colors...", "foreground=black background=red selection=red");

nROI = roiManager("Count");
for(i = 0; i < nROI; i++)
{
        roiManager("Select", i);
        run("Fill", "slice");
}


Again, unfortunately, I don't think there is a good method for what you are trying to do since the background matches the inside of the cells.....