*****
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:[log in to unmask]] On Behalf Of Philipp Bethge
> Sent: 21 March 2012 19:55
> To: [log in to unmask]
> 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
>> [log in to unmask]
>>
>>
>>
>>
>>
>>
>>
>>
>> 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
|