'smart' average z-projection

classic Classic list List threaded Threaded
9 messages Options
Philipp Bethge Philipp Bethge
Reply | Threaded
Open this post in threaded view
|

'smart' average z-projection

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear all,

I was wondering if somebody has worked with a 'smart' average
z-projection, that is a average projection of a z-stack that does not
average of the entire stack size but only over the slides where a signal
is actually present. So, for example, one has an oblique structure in a
large stack, lets say the structure has a z-extension of 4 slides but
the whole stack is 30 stacks large. As I understand the regular average
z-projection algorithm in ImageJ, every pixel is summed and devided by
the total number of slides in the stack. Then the signal of only 4
slides would be averaged over 30 slides, therefore reducing signal
intensity dramatically without further reducing background noise.
Of course, one would have to define 'signal' somehow, but I guess that
could be done manually by binarization of the image slides individually.

Any suggestions welcome,

Thanks alot,

--
Philipp Bethge
Johannes Schindelin Johannes Schindelin
Reply | Threaded
Open this post in threaded view
|

Re: 'smart' average z-projection

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Hi,

On Wed, 21 Mar 2012, Philipp Bethge wrote:

> I was wondering if somebody has worked with a 'smart' average
> z-projection, that is a average projection of a z-stack that does not
> average of the entire stack size but only over the slides where a signal
> is actually present. So, for example, one has an oblique structure in a
> large stack, lets say the structure has a z-extension of 4 slides but
> the whole stack is 30 stacks large. As I understand the regular average
> z-projection algorithm in ImageJ, every pixel is summed and devided by
> the total number of slides in the stack.  Then the signal of only 4
> slides would be averaged over 30 slides, therefore reducing signal
> intensity dramatically without further reducing background noise.  Of
> course, one would have to define 'signal' somehow, but I guess that
> could be done manually by binarization of the image slides individually.

You could use a weighted sum rather than the mean intensity, for example
by multiplying with the squared difference to the mean intensity.

Ciao,
Johannes
Glen MacDonald-2 Glen MacDonald-2
Reply | Threaded
Open this post in threaded view
|

Re: 'smart' average z-projection

In reply to this post by Philipp Bethge
*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear Philipp,
Duplicate the stack, threshold for the structure then make the tholded stack binary
dividing by 255 converts the binarized stack from 0+255 to 0+1
multiply the 2 stacks and project the result.  
this function does all this, choosing middle slice for setting the threshold

Maybe this is helpful,

function thresholdprojection(){
        stackid=getImageID;
        no=nSlices;
        stackname=getTitle;
        run("Duplicate...", "title=[dup] duplicate range=1-no");
        setSlice((floor(no/2)));
        run("Threshold...");
        waitForUser("Set Threshold then click 'OK'.");
        setBatchMode(true);
        getThreshold(lower,upper);
        run("Make Binary", "black");
        run("Divide...", "value=255 stack");
        rename("divided");
        bindupid=getImageID;
        imageCalculator("Multiply create stack", stackid ,bindupid);
        run("Z Project...", "start=1 stop=no projection=[Sum Slices]");
        rename(stackname+"sum");
        sumid=getImageID;
        setBatchMode(false);
        selectImage(bindupid);//closing and renaming actions must occur outside of the batch mode
        close();
}

Regards,
Glen
Glen MacDonald
Core for Communication Research
Virginia Merrill Bloedel Hearing Research Center
Box 357923
University of Washington
Seattle, WA 98195-7923  USA
(206) 616-4156
[hidden email]








On Mar 21, 2012, at 8:20 AM, Philipp Bethge wrote:

> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> Dear all,
>
> I was wondering if somebody has worked with a 'smart' average z-projection, that is a average projection of a z-stack that does not average of the entire stack size but only over the slides where a signal is actually present. So, for example, one has an oblique structure in a large stack, lets say the structure has a z-extension of 4 slides but the whole stack is 30 stacks large. As I understand the regular average z-projection algorithm in ImageJ, every pixel is summed and devided by the total number of slides in the stack. Then the signal of only 4 slides would be averaged over 30 slides, therefore reducing signal intensity dramatically without further reducing background noise.
> Of course, one would have to define 'signal' somehow, but I guess that could be done manually by binarization of the image slides individually.
>
> Any suggestions welcome,
>
> Thanks alot,
>
> --
> Philipp Bethge
James Beals James Beals
Reply | Threaded
Open this post in threaded view
|

Re: 'smart' average z-projection

In reply to this post by Philipp Bethge
*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Hello,
Have you tried the Standard Deviation projection?
I really like that it w ill not over saturate, and the projection looks "natural"
best
James Beals
[hidden email]



On Mar 21, 2012, at 11:20 AM, Philipp Bethge wrote:

> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> Dear all,
>
> I was wondering if somebody has worked with a 'smart' average z-projection, that is a average projection of a z-stack that does not average of the entire stack size but only over the slides where a signal is actually present. So, for example, one has an oblique structure in a large stack, lets say the structure has a z-extension of 4 slides but the whole stack is 30 stacks large. As I understand the regular average z-projection algorithm in ImageJ, every pixel is summed and devided by the total number of slides in the stack. Then the signal of only 4 slides would be averaged over 30 slides, therefore reducing signal intensity dramatically without further reducing background noise.
> Of course, one would have to define 'signal' somehow, but I guess that could be done manually by binarization of the image slides individually.
>
> Any suggestions welcome,
>
> Thanks alot,
>
> --
> Philipp Bethge
Lloyd Donaldson Lloyd Donaldson
Reply | Threaded
Open this post in threaded view
|

Re: 'smart' average z-projection

In reply to this post by Philipp Bethge
*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Philipp

Calculate the sum as normal but divide only by the number of pixels greater than some threshold - we typically use 5 or 10 which excludes any black/empty pixels. This avoids the projection being dim compared to say a maximum intensity projection, where there are empty regions within the volume.


Dr Lloyd Donaldson

Senior Scientist, Project Leader - Microscopy/Wood Identification
Scion - Forests . Products . Innovation
Private Bag 3020, Rotorua
49 Sala Street, Rotorua 3010
New Zealand

Ph: 64 7 343 5581
www.scionresearch.com



-----Original Message-----
From: Confocal Microscopy List [mailto:[hidden email]] On Behalf Of Philipp Bethge
Sent: Thursday, 22 March 2012 4:21 a.m.
To: [hidden email]
Subject: 'smart' average z-projection

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear all,

I was wondering if somebody has worked with a 'smart' average
z-projection, that is a average projection of a z-stack that does not
average of the entire stack size but only over the slides where a signal
is actually present. So, for example, one has an oblique structure in a
large stack, lets say the structure has a z-extension of 4 slides but
the whole stack is 30 stacks large. As I understand the regular average
z-projection algorithm in ImageJ, every pixel is summed and devided by
the total number of slides in the stack. Then the signal of only 4
slides would be averaged over 30 slides, therefore reducing signal
intensity dramatically without further reducing background noise.
Of course, one would have to define 'signal' somehow, but I guess that
could be done manually by binarization of the image slides individually.

Any suggestions welcome,

Thanks alot,

--
Philipp Bethge



This e-mail and any attachments may contain information which is confidential or subject to copyright. If you receive this e-mail in error, please delete it.
Scion does not accept responsibility for anything in this e-mail which is not provided in the  course of Scion's usual business or for any computer virus, data corruption, interference or delay arising from this e-mail.
Philipp Bethge Philipp Bethge
Reply | Threaded
Open this post in threaded view
|

Re: 'smart' average z-projection

In reply to this post by Glen MacDonald-2
*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear Users,

Wow, thanks alot to everybody for the quick reply and the solutions offered.
I tried out the one from Glen and it works very nice!

Thanks alot,


> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> Dear Philipp,
> Duplicate the stack, threshold for the structure then make the tholded stack binary
> dividing by 255 converts the binarized stack from 0+255 to 0+1
> multiply the 2 stacks and project the result.
> this function does all this, choosing middle slice for setting the threshold
>
> Maybe this is helpful,
>
> function thresholdprojection(){
> stackid=getImageID;
> no=nSlices;
> stackname=getTitle;
> run("Duplicate...", "title=[dup] duplicate range=1-no");
> setSlice((floor(no/2)));
> run("Threshold...");
> waitForUser("Set Threshold then click 'OK'.");
> setBatchMode(true);
> getThreshold(lower,upper);
> run("Make Binary", "black");
> run("Divide...", "value=255 stack");
> rename("divided");
> bindupid=getImageID;
> imageCalculator("Multiply create stack", stackid ,bindupid);
> run("Z Project...", "start=1 stop=no projection=[Sum Slices]");
> rename(stackname+"sum");
> sumid=getImageID;
> setBatchMode(false);
> selectImage(bindupid);//closing and renaming actions must occur outside of the batch mode
> close();
> }
>
> Regards,
> Glen
> Glen MacDonald
> Core for Communication Research
> Virginia Merrill Bloedel Hearing Research Center
> Box 357923
> University of Washington
> Seattle, WA 98195-7923  USA
> (206) 616-4156
> [hidden email]
>
>
>
>
>
>
>
>
> On Mar 21, 2012, at 8:20 AM, Philipp Bethge wrote:
>
>> *****
>> To join, leave or search the confocal microscopy listserv, go to:
>> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
>> *****
>>
>> Dear all,
>>
>> I was wondering if somebody has worked with a 'smart' average z-projection, that is a average projection of a z-stack that does not average of the entire stack size but only over the slides where a signal is actually present. So, for example, one has an oblique structure in a large stack, lets say the structure has a z-extension of 4 slides but the whole stack is 30 stacks large. As I understand the regular average z-projection algorithm in ImageJ, every pixel is summed and devided by the total number of slides in the stack. Then the signal of only 4 slides would be averaged over 30 slides, therefore reducing signal intensity dramatically without further reducing background noise.
>> Of course, one would have to define 'signal' somehow, but I guess that could be done manually by binarization of the image slides individually.
>>
>> Any suggestions welcome,
>>
>> Thanks alot,
>>
>> --
>> Philipp Bethge


--
Philipp Bethge
Straatman, Kees (Dr.) Straatman, Kees (Dr.)
Reply | Threaded
Open this post in threaded view
|

Re: 'smart' average z-projection

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear Philipp, Glen and list,

I tried the code Glen gave but the macro did not behave as I expected, at least not in my hands. Problem was the line 'run("Make Binary", "black");'  Changes in threshold settings were not reflected in the final image. I made a small change what worked for me. Just in case others have the same problem:

macro Smart_Average{
        stackid=getImageID;
        no=nSlices;
        stackname=getTitle;
        run("Duplicate...", "title=[dup] duplicate range=1-no");
        setSlice((floor(no/2)));
        run("Threshold...");
        waitForUser("Set Threshold then click 'OK'.");
        setBatchMode(true);
        run("Convert to Mask", "  black");
        run("Divide...", "value=255 stack");
        rename("divided");
        bindupid=getImageID;
        imageCalculator("Multiply create stack", stackid ,bindupid);
        run("Z Project...", "start=1 stop=no projection=[Sum Slices]");
        rename(stackname+"sum");
        sumid=getImageID;
        setBatchMode(false);
        selectImage(bindupid);//closing and renaming actions must occur outside of the batch mode
        close();
}

Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Centre for Core Biotechnology Services
College of Medicine, Biological Sciences and Psychology
University of Leicester

http://www.le.ac.uk/biochem/microscopy/home.html


-----Original Message-----
From: Confocal Microscopy List [mailto:[hidden email]] On Behalf Of Philipp Bethge
Sent: 21 March 2012 19:55
To: [hidden email]
Subject: Re: 'smart' average z-projection

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear Users,

Wow, thanks alot to everybody for the quick reply and the solutions offered.
I tried out the one from Glen and it works very nice!

Thanks alot,


> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> Dear Philipp,
> Duplicate the stack, threshold for the structure then make the tholded stack binary
> dividing by 255 converts the binarized stack from 0+255 to 0+1
> multiply the 2 stacks and project the result.
> this function does all this, choosing middle slice for setting the threshold
>
> Maybe this is helpful,
>
> function thresholdprojection(){
> stackid=getImageID;
> no=nSlices;
> stackname=getTitle;
> run("Duplicate...", "title=[dup] duplicate range=1-no");
> setSlice((floor(no/2)));
> run("Threshold...");
> waitForUser("Set Threshold then click 'OK'.");
> setBatchMode(true);
> getThreshold(lower,upper);
> run("Make Binary", "black");
> run("Divide...", "value=255 stack");
> rename("divided");
> bindupid=getImageID;
> imageCalculator("Multiply create stack", stackid ,bindupid);
> run("Z Project...", "start=1 stop=no projection=[Sum Slices]");
> rename(stackname+"sum");
> sumid=getImageID;
> setBatchMode(false);
> selectImage(bindupid);//closing and renaming actions must occur outside of the batch mode
> close();
> }
>
> Regards,
> Glen
> Glen MacDonald
> Core for Communication Research
> Virginia Merrill Bloedel Hearing Research Center
> Box 357923
> University of Washington
> Seattle, WA 98195-7923  USA
> (206) 616-4156
> [hidden email]
>
>
>
>
>
>
>
>
> On Mar 21, 2012, at 8:20 AM, Philipp Bethge wrote:
>
>> *****
>> To join, leave or search the confocal microscopy listserv, go to:
>> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
>> *****
>>
>> Dear all,
>>
>> I was wondering if somebody has worked with a 'smart' average z-projection, that is a average projection of a z-stack that does not average of the entire stack size but only over the slides where a signal is actually present. So, for example, one has an oblique structure in a large stack, lets say the structure has a z-extension of 4 slides but the whole stack is 30 stacks large. As I understand the regular average z-projection algorithm in ImageJ, every pixel is summed and devided by the total number of slides in the stack. Then the signal of only 4 slides would be averaged over 30 slides, therefore reducing signal intensity dramatically without further reducing background noise.
>> Of course, one would have to define 'signal' somehow, but I guess that could be done manually by binarization of the image slides individually.
>>
>> Any suggestions welcome,
>>
>> Thanks alot,
>>
>> --
>> Philipp Bethge


--
Philipp Bethge
Glen MacDonald-2 Glen MacDonald-2
Reply | Threaded
Open this post in threaded view
|

Re: 'smart' average z-projection

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear Kees,
did you run this on 8-bit images or 16-bit? 'run("Make Binary", "black");' and 'run("Convert to Mask", "  black");' behave similarly on 16-bit images, but run("Make Binary", "black"); on an 8-bit does not set to 0+255. However,  dividing the Make Binary 8-bit  image by 255 effectively sets the image to 0+1 due to rounding.  My macro was written for 16-bit images, but I'll change it to prevent future issues if used with 8-bit.  thanks for pointing this out.  

Regards,
Glen
On Mar 22, 2012, at 4:28 AM, Straatman, Kees R. (Dr.) wrote:

> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> Dear Philipp, Glen and list,
>
> I tried the code Glen gave but the macro did not behave as I expected, at least not in my hands. Problem was the line 'run("Make Binary", "black");'  Changes in threshold settings were not reflected in the final image. I made a small change what worked for me. Just in case others have the same problem:
>
> macro Smart_Average{
> stackid=getImageID;
> no=nSlices;
> stackname=getTitle;
> run("Duplicate...", "title=[dup] duplicate range=1-no");
> setSlice((floor(no/2)));
> run("Threshold...");
> waitForUser("Set Threshold then click 'OK'.");
> setBatchMode(true);
> run("Convert to Mask", "  black");
> run("Divide...", "value=255 stack");
> rename("divided");
> bindupid=getImageID;
> imageCalculator("Multiply create stack", stackid ,bindupid);
> run("Z Project...", "start=1 stop=no projection=[Sum Slices]");
> rename(stackname+"sum");
> sumid=getImageID;
> setBatchMode(false);
> selectImage(bindupid);//closing and renaming actions must occur outside of the batch mode
> close();
> }
>
> Best wishes
>
> Kees
>
>
> Dr Ir K.R. Straatman
> Senior Experimental Officer
> Centre for Core Biotechnology Services
> College of Medicine, Biological Sciences and Psychology
> University of Leicester
>
> http://www.le.ac.uk/biochem/microscopy/home.html
>
>
> -----Original Message-----
> From: Confocal Microscopy List [mailto:[hidden email]] On Behalf Of Philipp Bethge
> Sent: 21 March 2012 19:55
> To: [hidden email]
> Subject: Re: 'smart' average z-projection
>
> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> Dear Users,
>
> Wow, thanks alot to everybody for the quick reply and the solutions offered.
> I tried out the one from Glen and it works very nice!
>
> Thanks alot,
>
>
>> *****
>> To join, leave or search the confocal microscopy listserv, go to:
>> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
>> *****
>>
>> Dear Philipp,
>> Duplicate the stack, threshold for the structure then make the tholded stack binary
>> dividing by 255 converts the binarized stack from 0+255 to 0+1
>> multiply the 2 stacks and project the result.
>> this function does all this, choosing middle slice for setting the threshold
>>
>> Maybe this is helpful,
>>
>> function thresholdprojection(){
>> stackid=getImageID;
>> no=nSlices;
>> stackname=getTitle;
>> run("Duplicate...", "title=[dup] duplicate range=1-no");
>> setSlice((floor(no/2)));
>> run("Threshold...");
>> waitForUser("Set Threshold then click 'OK'.");
>> setBatchMode(true);
>> getThreshold(lower,upper);
>> run("Make Binary", "black");
>> run("Divide...", "value=255 stack");
>> rename("divided");
>> bindupid=getImageID;
>> imageCalculator("Multiply create stack", stackid ,bindupid);
>> run("Z Project...", "start=1 stop=no projection=[Sum Slices]");
>> rename(stackname+"sum");
>> sumid=getImageID;
>> setBatchMode(false);
>> selectImage(bindupid);//closing and renaming actions must occur outside of the batch mode
>> close();
>> }
>>
>> Regards,
>> Glen
>> Glen MacDonald
>> Core for Communication Research
>> Virginia Merrill Bloedel Hearing Research Center
>> Box 357923
>> University of Washington
>> Seattle, WA 98195-7923  USA
>> (206) 616-4156
>> [hidden email]
>>
>>
>>
>>
>>
>>
>>
>>
>> On Mar 21, 2012, at 8:20 AM, Philipp Bethge wrote:
>>
>>> *****
>>> To join, leave or search the confocal microscopy listserv, go to:
>>> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
>>> *****
>>>
>>> Dear all,
>>>
>>> I was wondering if somebody has worked with a 'smart' average z-projection, that is a average projection of a z-stack that does not average of the entire stack size but only over the slides where a signal is actually present. So, for example, one has an oblique structure in a large stack, lets say the structure has a z-extension of 4 slides but the whole stack is 30 stacks large. As I understand the regular average z-projection algorithm in ImageJ, every pixel is summed and devided by the total number of slides in the stack. Then the signal of only 4 slides would be averaged over 30 slides, therefore reducing signal intensity dramatically without further reducing background noise.
>>> Of course, one would have to define 'signal' somehow, but I guess that could be done manually by binarization of the image slides individually.
>>>
>>> Any suggestions welcome,
>>>
>>> Thanks alot,
>>>
>>> --
>>> Philipp Bethge
>
>
> --
> Philipp Bethge
Straatman, Kees (Dr.) Straatman, Kees (Dr.)
Reply | Threaded
Open this post in threaded view
|

Re: 'smart' average z-projection

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear Glen,

Indeed, I was using an 8 bit images, the sample Confocal-Series.tif. But I was not aware of this difference in thresholding between 8 bit and 16 bit images...

Cheers

Kees

-----Original Message-----
From: Confocal Microscopy List [mailto:[hidden email]] On Behalf Of Glen MacDonald
Sent: 22 March 2012 18:25
To: [hidden email]
Subject: Re: 'smart' average z-projection

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Dear Kees,
did you run this on 8-bit images or 16-bit? 'run("Make Binary", "black");' and 'run("Convert to Mask", "  black");' behave similarly on 16-bit images, but run("Make Binary", "black"); on an 8-bit does not set to 0+255. However,  dividing the Make Binary 8-bit  image by 255 effectively sets the image to 0+1 due to rounding.  My macro was written for 16-bit images, but I'll change it to prevent future issues if used with 8-bit.  thanks for pointing this out.  

Regards,
Glen
On Mar 22, 2012, at 4:28 AM, Straatman, Kees R. (Dr.) wrote:

> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> Dear Philipp, Glen and list,
>
> I tried the code Glen gave but the macro did not behave as I expected, at least not in my hands. Problem was the line 'run("Make Binary", "black");'  Changes in threshold settings were not reflected in the final image. I made a small change what worked for me. Just in case others have the same problem:
>
> macro Smart_Average{
> stackid=getImageID;
> no=nSlices;
> stackname=getTitle;
> run("Duplicate...", "title=[dup] duplicate range=1-no");
> setSlice((floor(no/2)));
> run("Threshold...");
> waitForUser("Set Threshold then click 'OK'.");
> setBatchMode(true);
> run("Convert to Mask", "  black");
> run("Divide...", "value=255 stack");
> rename("divided");
> bindupid=getImageID;
> imageCalculator("Multiply create stack", stackid ,bindupid);
> run("Z Project...", "start=1 stop=no projection=[Sum Slices]");
> rename(stackname+"sum");
> sumid=getImageID;
> setBatchMode(false);
> selectImage(bindupid);//closing and renaming actions must occur outside of the batch mode
> close();
> }
>
> Best wishes
>
> Kees
>
>
> Dr Ir K.R. Straatman
> Senior Experimental Officer
> Centre for Core Biotechnology Services
> College of Medicine, Biological Sciences and Psychology
> University of Leicester
>
> http://www.le.ac.uk/biochem/microscopy/home.html
>
>
> -----Original Message-----
> From: Confocal Microscopy List [mailto:[hidden email]] On Behalf Of Philipp Bethge
> Sent: 21 March 2012 19:55
> To: [hidden email]
> Subject: Re: 'smart' average z-projection
>
> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> Dear Users,
>
> Wow, thanks alot to everybody for the quick reply and the solutions offered.
> I tried out the one from Glen and it works very nice!
>
> Thanks alot,
>
>
>> *****
>> To join, leave or search the confocal microscopy listserv, go to:
>> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
>> *****
>>
>> Dear Philipp,
>> Duplicate the stack, threshold for the structure then make the tholded stack binary
>> dividing by 255 converts the binarized stack from 0+255 to 0+1
>> multiply the 2 stacks and project the result.
>> this function does all this, choosing middle slice for setting the threshold
>>
>> Maybe this is helpful,
>>
>> function thresholdprojection(){
>> stackid=getImageID;
>> no=nSlices;
>> stackname=getTitle;
>> run("Duplicate...", "title=[dup] duplicate range=1-no");
>> setSlice((floor(no/2)));
>> run("Threshold...");
>> waitForUser("Set Threshold then click 'OK'.");
>> setBatchMode(true);
>> getThreshold(lower,upper);
>> run("Make Binary", "black");
>> run("Divide...", "value=255 stack");
>> rename("divided");
>> bindupid=getImageID;
>> imageCalculator("Multiply create stack", stackid ,bindupid);
>> run("Z Project...", "start=1 stop=no projection=[Sum Slices]");
>> rename(stackname+"sum");
>> sumid=getImageID;
>> setBatchMode(false);
>> selectImage(bindupid);//closing and renaming actions must occur outside of the batch mode
>> close();
>> }
>>
>> Regards,
>> Glen
>> Glen MacDonald
>> Core for Communication Research
>> Virginia Merrill Bloedel Hearing Research Center
>> Box 357923
>> University of Washington
>> Seattle, WA 98195-7923  USA
>> (206) 616-4156
>> [hidden email]
>>
>>
>>
>>
>>
>>
>>
>>
>> On Mar 21, 2012, at 8:20 AM, Philipp Bethge wrote:
>>
>>> *****
>>> To join, leave or search the confocal microscopy listserv, go to:
>>> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
>>> *****
>>>
>>> Dear all,
>>>
>>> I was wondering if somebody has worked with a 'smart' average z-projection, that is a average projection of a z-stack that does not average of the entire stack size but only over the slides where a signal is actually present. So, for example, one has an oblique structure in a large stack, lets say the structure has a z-extension of 4 slides but the whole stack is 30 stacks large. As I understand the regular average z-projection algorithm in ImageJ, every pixel is summed and devided by the total number of slides in the stack. Then the signal of only 4 slides would be averaged over 30 slides, therefore reducing signal intensity dramatically without further reducing background noise.
>>> Of course, one would have to define 'signal' somehow, but I guess that could be done manually by binarization of the image slides individually.
>>>
>>> Any suggestions welcome,
>>>
>>> Thanks alot,
>>>
>>> --
>>> Philipp Bethge
>
>
> --
> Philipp Bethge