How can assign a color channel to an image series?
Mostrar comentarios más antiguos
My question is two-fold:
I'm using Bio-Formats to import an image series (or stack) from multiphoton into Matlab.
No problem there. I have two series that I want to assign a color (such as blue for DAPI and red for Collagen) similar to what can be done in ImageJ, where you assign an image series a channel and ultimately merge stacks.
1) As a preliminary step I tried isolating a single frame out, which was a grayscale image (uint16). I attempted the following (based on https://www.mathworks.com/matlabcentral/answers/46698-how-to-convert-gray-image-to-color-image):
RGBimage=cat(3,grayimage,zeros(size(grayimage)),zeros(size(grayimage)))
imshow(RGBimage) or imshow(RGBimage,[])
I get a black window, where I expected some structures to be red. However, imshow(grayimage,[]) works fine. How can I add color to a single frame?
2) Scaling this up: Is there a way to apply a color to the whole image series that I import from Bio-Formats?
This may be something very basic. I tried looking elsewhere and have attempted to apply suggestions but have had no luck thus far. Many thanks!
2 comentarios
Walter Roberson
el 13 de Feb. de 2020
RGBimage=cat(3,grayimage,size(grayimage),size(grayimage))
would be an error unless grayimage happened to be a vector with the same length as size(grayimage) -- which would have to be length 2. For example,
grayimage = randi(255,1,2);
RGBimage = cat(3, grayimage, size(grayimage), size(grayimage))
size(grayimage) would be 1 2 which would be a vector of length 2, and it would be valid to cat(3) the vector of length 2 in grayimage with the two size vectors.
Samuel Salinas
el 14 de Feb. de 2020
Respuesta aceptada
Más respuestas (1)
Spencer Chen
el 13 de Feb. de 2020
1) What you want to achieve get is probably something like this:
RGBimage=cat(3,grayimage,zeros(size(grayimage),'uint16'),zeros(size(grayimage),'uint16'));
or you can do:
RGBimage = repmat(grayimage,[1 1 3]);
RGBimage(:,:,2:3) = 0;
Anyway, I gave you 2 examples because it will benefit your Matlab skills if you can understand what's happening in both.
2) You can simply pseudo color your plots in red-scale using the colormap() function after you plot.
Blessings,
Spencer
1 comentario
Samuel Salinas
el 14 de Feb. de 2020
Categorías
Más información sobre Biomedical Imaging en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!