Question

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!

Was it helpful?

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

OTHER TIPS

You can sum up bright pixels of each image with one another after coloring each image. This way you will have mixed colors on overlapped areas which you will miss using max function. Although I like the previous answer more than mine.

hStep = 1/N;
currentH = 0;
resultImage = uint8(zeros(x,y,3));
for i = 1 : N
   rgbColor = hsv2rgb(currentH,1,0.5);
   resultImage(:,:,1) = resultImage(:,:,1) + im(:,:,i) * rgbColor(1);
   resultImage(:,:,2) = resultImage(:,:,2) + im(:,:,i) * rgbColor(2);
   resultImage(:,:,3) = resultImage(:,:,3) + im(:,:,i) * rgbColor(3);
   currentH = currentH + hStep;
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top