How to convert a threshold area to a selection?

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

How to convert a threshold area to a selection?

Hugo Gratama van Andel
Dear Users,

If I specifiy a threshold value ( with Image->Adjust->Threshold )How can
I convert the threshold area to a selection afterwards? I can't see how
to do this with ImageJ. Or does someone knows a plugin in which you can
specify a lower and an upper threshold to form a selection?

Thanks in advance,

Hugo Gratama van Andel


--
Hugo Gratama van Andel - MSc
Academic Medical Centre - University of Amsterdam
Dept. Medical Physics      L0-152
Meibergdreef 9
1105 AZ Amsterdam
The Netherlands
Phone  :  +31 20 566 5206
FAX    :  +31 20 691 7233
e-mail :  [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: How to convert a threshold area to a selection?

Wayne Rasband
> If I specifiy a threshold value ( with Image->Adjust->Threshold )
> How can I convert the threshold area to a selection afterwards? I  
> can't see how to do this with ImageJ. Or does someone knows a  
> plugin in which you can specify a lower and an upper threshold to  
> form a selection?

You can use the wand tool to convert a thresholded area to a selection.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: How to convert a threshold area to a selection?

Gabriel Landini
In reply to this post by Hugo Gratama van Andel
On Monday 20 February 2006 12:43, Hugo Gratama van Andel wrote:
> If I specifiy a threshold value ( with Image->Adjust->Threshold )How can
> I convert the threshold area to a selection afterwards? I can't see how
> to do this with ImageJ.

Here there is way (you probably do not need the Set Measurements line):
Please mind the line breaks inserted by the mailer.

//-------------------------8<---------------------------
// AreasToROIs.txt
// G. Landini @ bham. ac. uk
//  26/Nov/2004
// Converts thresholded areas to a complex ROI
//
// No to be used with stacks! (works on the current slice only)

// --- example image
run("Dot Blot (7K)");
run("Smooth");
run("Smooth");
setThreshold(0,159);
// --- example image

run("Select None");
run("Set Measurements...", "area perimeter circularity decimal=3");
run("Analyze Particles...", "minimum=1 maximum=999999 bins=20 show=Nothing
clear record");
run("Select None");
for (i=0; i<nResults; i++) {
    x = getResult('XStart', i);
    y = getResult('YStart', i);
    if (i!=0) setKeyDown("shift");
    doWand(x,y);
}
setKeyDown("none");
resetThreshold();
//-------------------------8<---------------------------
Reply | Threaded
Open this post in threaded view
|

Re: How to convert a threshold area to a selection?

Hugo Gratama van Andel
Thanks Gabriel for your macro. It's a pity it doesn't work for stacks.
Wayne wrote about the wand, but I was glad you shown a way to automize
it for the whole image.
Still it does seems strange to me that you need a macro for such simple
operation (from one sort of selection--thresholding to another selection
). It is defenitely on my personal feature-request list for ImageJ.
with regards,
Hugo Gratama van Andel

Gabriel Landini wrote:

> On Monday 20 February 2006 12:43, Hugo Gratama van Andel wrote:
>
>>If I specifiy a threshold value ( with Image->Adjust->Threshold )How can
>>I convert the threshold area to a selection afterwards? I can't see how
>>to do this with ImageJ.
>
>
> Here there is way (you probably do not need the Set Measurements line):
> Please mind the line breaks inserted by the mailer.
>
> //-------------------------8<---------------------------
> // AreasToROIs.txt
> // G. Landini @ bham. ac. uk
> //  26/Nov/2004
> // Converts thresholded areas to a complex ROI
> //
> // No to be used with stacks! (works on the current slice only)
>
> // --- example image
> run("Dot Blot (7K)");
> run("Smooth");
> run("Smooth");
> setThreshold(0,159);
> // --- example image
>
> run("Select None");
> run("Set Measurements...", "area perimeter circularity decimal=3");
> run("Analyze Particles...", "minimum=1 maximum=999999 bins=20 show=Nothing
> clear record");
> run("Select None");
> for (i=0; i<nResults; i++) {
>     x = getResult('XStart', i);
>     y = getResult('YStart', i);
>     if (i!=0) setKeyDown("shift");
>     doWand(x,y);
> }
> setKeyDown("none");
> resetThreshold();
> //-------------------------8<---------------------------
>

--
Hugo Gratama van Andel - MSc
Academic Medical Centre - University of Amsterdam
Dept. Medical Physics      L0-152
Meibergdreef 9
1105 AZ Amsterdam
The Netherlands
Phone  :  +31 20 566 5206
FAX    :  +31 20 691 7233
e-mail :  [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: How to convert a threshold area to a selection?

Gabriel Landini
On Tuesday 21 February 2006 08:14, Hugo Gratama van Andel wrote:

> It's a pity it doesn't work for stacks.

From just recently IJ can record the slice number, so you can modify it to
work with slices, but remember that selections are idependent of the slices.
After you changed slice and created new selections from areas, you lost the
old selections of the previous slice. So unless you processed the selections
before the change, the macro would be quite confusing. I think that this is
best done in a macro -that one can modify easily- rather than a command.

> Still it does seems strange to me that you need a macro for such simple
> operation (from one sort of selection--thresholding to another selection
> ). > It is defenitely on my personal feature-request list for ImageJ.

Well, now that you can do it, the difference of whether it is an internal
command or a macro or a plugin is not an issue anymore.
Further, the macro uses the results table so I would have thought that it is a
bit more complex to add it as an internal command (you would need to delete
the data already there and that may not be desirable).
Maybe there is another way round.

Cheers,

Gabriel


 
Reply | Threaded
Open this post in threaded view
|

Re: How to convert a threshold area to a selection?

Florian Erfurth
In reply to this post by Hugo Gratama van Andel
I'm working with ImageJ 1.38i and there it is possible, after specifying a threshold (red areas), to use the Edit / Selection / Create Selection command to turn it into an selection (ROI). This selection can even be used for stack operations like 'Plot Z-axis Profile'. It took me a while till I found that out... Easy, isn't it ?

Florian


Hugo Gratama van Andel wrote
Dear Users,

If I specifiy a threshold value ( with Image->Adjust->Threshold )How can
I convert the threshold area to a selection afterwards? I can't see how
to do this with ImageJ. Or does someone knows a plugin in which you can
specify a lower and an upper threshold to form a selection?

Thanks in advance,

Hugo Gratama van Andel


--
Hugo Gratama van Andel - MSc
Academic Medical Centre - University of Amsterdam
Dept. Medical Physics      L0-152
Meibergdreef 9
1105 AZ Amsterdam
The Netherlands
Phone  :  +31 20 566 5206
FAX    :  +31 20 691 7233
e-mail :  h.a.gratamavanandel@amc.uva.nl