Search code examples
matlabimage-processingparticles

maximum intensity projection matlab with color


Hi all I have a stack of images of fluorescent labeled particles that are moving through time. The imagestack is gray scaled.

I computed a maximum intensity projection by taking the maximum of the image stack in the 3rd dimension.

Example:
ImageStack(x,y,N) where N = 31 image frames.

2DProjection = max(ImageStack,[],3)

Now, since the 2D projection image is black and white, I was hoping to assign a color gradient so that I can get a sense of the flow of particles through time. Is there a way that I can overlay this image with color, so that I will know where a particle started, and where it ended up?

Thanks!


Solution

  • You could use the second output of max to get which frame the particular maximum came from. max returns an index matrix which indicates the index of each maximal value, which in your case will be the particular frame in which it occurred. If you use this with the imagesc function, you will be able to plot how the particles move with time. For instance:

    ImageStack(x,y,N) where N = 31 image frames.
    
    [2DProjection,FrameInfo] = max(ImageStack,[],3);
    imagesc(FrameInfo);
    set(gca,'ydir','normal'); % Otherwise the y-axis would be flipped