stack threshold

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

stack threshold

CosminM
Hi,
 
I have a question regarding thresholding of ImageJ stacks.
When using the threshold comand on the first slice, the rest of the stack
is thresholded in the same limits. I am studying bleaching processes and I
am interested in eliminating from my analysis pixels above a certain
value. The problem in the standard threshold is that the pixels eliminated
from the first slice might be reintroduced in the later slices when their
intensity falls in the threshold interval.
Is there any way to permanently eliminate those pixels from the whole
stack ?
 
Thank you,
Cosmin
Reply | Threaded
Open this post in threaded view
|

Re: stack threshold

Rotella, Anthony M. (GRC)[]
Cosmin,

If I understand your question correctly, you could simply write some
statement like:

for (n = 1; n <= nSlices; n++)
        setPixel(c, r, theValue);

theValue would just be some value that would guarantee that that pixel
would be thresholded out every time. Unfortunately I think you may have
to threshold each slice 1 by 1 if you wanted to do this. That's the
first thing that comes to my head, but maybe there are better ways to do
it.

>-----Original Message-----
>From: ImageJ Interest Group [mailto:[hidden email]] On
>Behalf Of Cosmin Mihai
>Sent: Friday, July 06, 2007 3:55 PM
>To: [hidden email]
>Subject: stack threshold
>
>Hi,
>
>I have a question regarding thresholding of ImageJ stacks.
>When using the threshold comand on the first slice, the rest
>of the stack is thresholded in the same limits. I am studying
>bleaching processes and I am interested in eliminating from my
>analysis pixels above a certain value. The problem in the
>standard threshold is that the pixels eliminated from the
>first slice might be reintroduced in the later slices when
>their intensity falls in the threshold interval.
>Is there any way to permanently eliminate those pixels from
>the whole stack ?
>
>Thank you,
>Cosmin
>
Reply | Threaded
Open this post in threaded view
|

Re: stack threshold

CosminM
Anthony,
 
Thanks for your sugestion - this would require to write a plugin which I do
not know how to do. I thought there might be a way to do it with the features
already available in Image J.
 
Cosmin
 

________________________________

From: ImageJ Interest Group on behalf of Rotella, Anthony M. (GRC)[]
Sent: Fri 7/6/2007 4:13 PM
To: [hidden email]
Subject: Re: stack threshold



Cosmin,

If I understand your question correctly, you could simply write some
statement like:

for (n = 1; n <= nSlices; n++)
        setPixel(c, r, theValue);

theValue would just be some value that would guarantee that that pixel
would be thresholded out every time. Unfortunately I think you may have
to threshold each slice 1 by 1 if you wanted to do this. That's the
first thing that comes to my head, but maybe there are better ways to do
it.

>-----Original Message-----
>From: ImageJ Interest Group [mailto:[hidden email]] On
>Behalf Of Cosmin Mihai
>Sent: Friday, July 06, 2007 3:55 PM
>To: [hidden email]
>Subject: stack threshold
>
>Hi,
>
>I have a question regarding thresholding of ImageJ stacks.
>When using the threshold comand on the first slice, the rest
>of the stack is thresholded in the same limits. I am studying
>bleaching processes and I am interested in eliminating from my
>analysis pixels above a certain value. The problem in the
>standard threshold is that the pixels eliminated from the
>first slice might be reintroduced in the later slices when
>their intensity falls in the threshold interval.
>Is there any way to permanently eliminate those pixels from
>the whole stack ?
>
>Thank you,
>Cosmin
>
Reply | Threaded
Open this post in threaded view
|

Information from Macro

quantumlottie
Hi

I was wondering if there was an easy way for a plugin to get information
from a macro?

I have an old macro I use to put a grid on an image. I have now
developed a plugin to help analyse the image with the grid on it however
to go forward I really need the locations of the grid points.
I could to this within the plugin but it would be a lot of work when I
have the macro there with the information in it.

Thanks
Lottie
Reply | Threaded
Open this post in threaded view
|

Re: Information from Macro

Michael Schmid
Hi Charlotte,

if the macro calls the plugin, you could simply use the
GenericDialog in the plugin, and pass the values as parameters
(run the plugin manually and use Macro>Record to see how to do
this).

In case your macro does not call the plugin, you can save the
data as global variables (use the "var" macro statement) and
make a wrapper macro for the plugin that calls the plugin with
these variables passed to the GenericDialog.

Otherwise, you have to store the values somewhere else, e.g.
with macro function setMetadata into the ImagePlus, and use
   String metadata = (String)imp.getProperty("Info");
for non-stack images or
   String  metadata = imp.getStack().getSliceLabel(imp.getCurrentSlice
());
for stacks.
Of course, you can also write the data into a file with a
fixed name and read the file in the plugin.
A disadvantage of these ways is that you will have to decode
strings to get numbers in your plugin.

Michael
________________________________________________________________

On 9 Jul 2007, at 14:32, Holmes, Charlotte wrote:

> Hi
>
> I was wondering if there was an easy way for a plugin to get  
> information
> from a macro?
>
> I have an old macro I use to put a grid on an image. I have now
> developed a plugin to help analyse the image with the grid on it  
> however
> to go forward I really need the locations of the grid points.
> I could to this within the plugin but it would be a lot of work when I
> have the macro there with the information in it.
>
> Thanks
> Lottie
Reply | Threaded
Open this post in threaded view
|

Re: Information from Macro

Ben.BigHair
In reply to this post by quantumlottie
On Jul 9, 2007, at 08:32 AM, Holmes, Charlotte wrote:

> Hi
>
> I was wondering if there was an easy way for a plugin to get  
> information
> from a macro?
>
> I have an old macro I use to put a grid on an image. I have now
> developed a plugin to help analyse the image with the grid on it  
> however
> to go forward I really need the locations of the grid points.
> I could to this within the plugin but it would be a lot of work when I
> have the macro there with the information in it.


Hello,

You might want to look at IJ.runMacro() and IJ.runMacroFile(). Each  
of these will run the macro you specify, deliver arguments (as  
String) to the macro, and return a String value from the macro to the  
calling plugin.  I use this a lot with arguments (and return values)  
concatenated into a single string delimited by the "\n" newline  
character.  I often use the first line of the argument for processing  
flags - like if I want the macro to run in batch mode, etc.  If I  
need a number of processing flags in the first line, I concatenate  
those with tabs or commas.

Here is a snippet from a macro that is called by a plugin....

> arg = split(getArgument(),"\n");//split all the records, the first  
> of which holds processing info
> pi = 3.141593;
> // get the first line of flags etc.  The first line has booleans,  
> filepaths,
> //  numbers etc. in tab-delimited fields
>     s = split(arg[0], "\t");
>     doVerbose = startsWith(s[0], "true");
>     doBatchMode = startsWith(s[1], "true");
>     doEnhance = startsWith(s[2], "true");
>     doScalebar = startsWith(s[3], "true");
>     cal = parseFloat(s[4]);
>     name = s[5];
>     dir = s[6];
>     maskDir = s[7];
>     doMask = !(startsWith(maskDir, "noMask"));
>     outlineDir = s[8];
>     doOutline = !(startsWith(outlineDir,"noOutline"));
>     distNN = s[9];
>     thresh = s[10];
>     closeHoles = s[11];
>     lightOrDark = s[12];
>     minSize = pow(s[13]/2.,2) * pi;  //convert minESD to minArea
>     maxSize= pow(s[14]/2., 2) * pi; //convert maxESD to maxArea
>     slice = parseInt(s[s.length-1]);
>
> n = arg.length-1;// the number of records to process


You probably get the idea. Hope that is what you are looking for.

Cheers,
Ben
Reply | Threaded
Open this post in threaded view
|

Re: stack threshold

Michael Schmid
In reply to this post by CosminM
Hi Cosmin,

what about converting the threshold of the first slice into a
selection
   run("Create Selection");
and then either replacing these pixels (or the non-selected ones,
using "Make Inverse", depending on your needs) by some value
that does not interfere with the analysis?
E.g. "Clear", "Fill", run("Min...", "value=255 stack"); etc.

Even without modifying the image, the selection will restrict
the area for future measurements of other slices, so just creating
the selection might be enough (e.g. if you use the histogram or
getStatistics for analysis of the stack slices).

Michael
________________________________________________________________

On 6 Jul 2007, at 21:55, Cosmin Mihai wrote:

> Hi,
>
> I have a question regarding thresholding of ImageJ stacks.
> When using the threshold comand on the first slice, the rest of the  
> stack
> is thresholded in the same limits. I am studying bleaching  
> processes and I
> am interested in eliminating from my analysis pixels above a certain
> value. The problem in the standard threshold is that the pixels  
> eliminated
> from the first slice might be reintroduced in the later slices when  
> their
> intensity falls in the threshold interval.
> Is there any way to permanently eliminate those pixels from the whole
> stack ?
>
> Thank you,
> Cosmin