CONFOCALMICROSCOPY Archives

December 2012

CONFOCALMICROSCOPY@LISTS.UMN.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Zdenek Svindrych <[log in to unmask]>
Reply To:
Confocal Microscopy List <[log in to unmask]>
Date:
Fri, 21 Dec 2012 13:45:11 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (101 lines)
*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

Hi Ronan,

this approach can be generatised to other "convolution kernels" than ...0,
0, 1/3, 1/3, 1/3, 0, 0, ... (in z-direction, you know)

Post some links to your images so we can quickly appreciate the improvement!
I didn't try it myself, I have no confocal stacks at hand right now.

Also the piece of code you have included looks more like Visual Basic than
Matlab... You are not taking the advantage of the huge parallelisation
Matlab syntax offers. Try and rewrite it without the for-loops! I have tried
it, well, the result is not as compact as I thought it should have been.
Indeed, there are no loops and this code should run at least a million times
faster (in interpretted mode, excluding input/output times, of course). And
without the boring comments it's just seven lines of nice, simple and easily
readable code for all the confocal Matlab guys out here :-). 

(PS: don't take it seriously, without a proper dataset I am not even able to
tell whether it works as intended...)

Cheers,

deden

%%%%%%% Matlab code begins here %%%%%%%%

% initialise our test image stack
src = zeros(10,10,4);

% fill it with some values
src = rand(size(src));

% find the maximum value in each XY position and the Z positions of these maxima
[maxproj, maxZpos] = max(src,[],3);

% find the positions above and below these maximas
% the edge values are adjusted (and subsequently treated twice)
% this can be changed, e.g. to an average of two vaues only...
maxZposPlus = min(maxZpos+1,size(src,3));
maxZposMinus = max(maxZpos-1,1);

% create the "above" and "below" images
% this is a bit tricky, maybe there is a better way around...

% first create a list of indices of all XY positions
[allX allY] = ind2sub(size(maxproj), 1:numel(maxproj));

% now dump the pixel values using these indiceas and the appropriate Z-coords
% to check that we did the indexing right, maxproj-maxprojCheck should
return all zeros!
maxprojCheck = reshape( src(sub2ind(size(src), allX, allY, maxZpos(:)')),
size(maxproj) ); % not needed, just a check
maxprojPlus = reshape( src(sub2ind(size(src), allX, allY, maxZposPlus(:)')),
size(maxproj) );
maxprojMinus = reshape( src(sub2ind(size(src), allX, allY,
maxZposMinus(:)')), size(maxproj) );

% and now the final image
maxproj_smartass = (maxproj + maxprojPlus + maxprojMinus) ./ 3;

%%%%%%% Matlab code ends here %%%%%%%%



On Fri, 21 Dec 2012 05:34:50 -0600, Ronan Chéreau <[log in to unmask]>
wrote:

>*****
>To join, leave or search the confocal microscopy listserv, go to:
>http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
>*****
>
>Hi fellows,
>
>Following the post on smart average
>(http://labrigger.com/blog/?s=smart+average), I propose another way to
>perform a projection of a z-stack that does not involve any thresolding or
>any filtering.
>As when you select the brightest pixel of the z-serie to obtain a maximum
>projection, my idea is to look for the z-plane from which the brightest
>pixel was taken and then average this pixel with the ones from the plane
>before and after.
>As a result, stochastic noise is greatly reduced and the real signal is
>consolidated knowing that it's always contained in more than one plane.
>
>I think some could be interested in this.
>regards
>
>Ronan Chéreau
>
>Here is the matlab code to perform the projection (2 functions: 1 to do the
>projection and 1 that is used by the first one to import a imagej like tiff
>stack):
>
>

ATOM RSS1 RSS2