How to calculate Maximum Intensity Projection(MIP) of a 3D image ????
Mostrar comentarios más antiguos
Hi everyone.
Does anyone know how to calculate MIP of a 3D image????
9 comentarios
Ryan
el 28 de Jun. de 2012
I know this is not in the spirit of the forum, but I believe the free NIH software, ImageJ, has a feature to visualize 3D datasets using MIP.
Joy
el 30 de Jun. de 2012
Walter Roberson
el 30 de Jun. de 2012
Would this be similar to Projection Persuit ? If so then it becomes a global minimization over a very large search space, which takes a very long time to calculate.
Joy
el 2 de Jul. de 2012
supermanu
el 27 de Jul. de 2015
I still do not know how to create a maximum intesity projection using matlab. Could you please exaplin?
Image Analyst
el 27 de Jul. de 2015
Did you see my answer? It has code. If that's not good for you, then start a new question and attach your images.
Cosmas Mwikirize
el 19 de Nov. de 2016
For an image axbxc, MIP=max(image,[],dim) where dim is the dimension along which you want to calculate the MIP (either 1,2 or 3). This result is similar to what you would get with "viewer3d".
Walter Roberson
el 19 de Nov. de 2016
That does not give Maximum Intensity. See my Answer, where I give code that calculates intensity based upon RGB.
Mohamed Amine Henchir
el 23 de Jul. de 2019
@Walter Roberson, I couldn't find the code in the link you provided for projection pursuit.
Respuesta aceptada
Más respuestas (2)
Walter Roberson
el 3 de Jul. de 2012
I will assume for this discussion that your RGB image stack is arranged as (X, Y, RGB, Z) and that it is named Stack
grayStack = squeeze( 0.2989 * Stack(:,:,1,:) + 0.5870 * Stack(:,:,2,:) + 0.1140 * Stack(:,:,3,:) ); %X, Y, Z after squeeze
[maxgray, maxidx] = max(grayStack, [], 3); %along the 3rd axis (Z)
nX = size(Stack,1);
nY = size(Stack,2);
[X, Y] = ndgrid( 1 : nX, 1 : nY );
MIP_R = Stack( sub2idx( size(Stack), X(:), Y(:), 1, maxidx(:) ) );
MIP_G = Stack( sub2idx( size(Stack), X(:), Y(:), 2, maxidx(:) ) );
MIP_B = Stack( sub2idx( size(Stack), X(:), Y(:), 3, maxidx(:) ) );
MIP = cat(3, reshape(MIP_R, nX, nY), reshape(MIP_G, nX, nY), reshape(MIP_B, nX, nY) );
image(MIP);
There are performance tweaks that can be done.
The code would be slightly different if the RGB is the 4th dimension instead of the third.
The first line of the code is effectively doing an rgb2gray() but for all of the image layer simultaneously. This conversion calculates the intensity (brightness) of each pixel in each slice. In the discussion with IA, the conversion from RGB to brightness (intensity) is not done, so the code there is not doing a Maximum Intensity Mapping. You should not be calculating the maximum R along the stack and the maximum G along the stack independently: you need the R, G, and B information combined at each pixel in order to calculate intensity there.
With intensity in hand, the code finds the maximum intensity along the Z, and the Z slice number that corresponds to the brightest point.
Once the slice number is done, there is some code that, in a vectorized way, pulls out the R, G, and B pixel values of the appropriate Z layer. And once it has those, it combines the three channels into a single RGB image.
2 comentarios
Joy
el 6 de Jul. de 2012
Hello Walter, How would it be for a grayscale image. Im doing it with the max function, but it does give a lot of white pixels and the image is really saturared compared to ImageJ Z proyection. Am i skipping any type of math procedure? Thanks!
Im doing Z proyection every 50 stacks (my image dimensions are 280,1000,4000).
PD: I do have an error on s=41 because of crop dimensions.
STACK_pass=50;
INPH_filt_pass=0:STACK_pass:4000;
INPH_filt_pass(1)=1;
NUM_stacks= length(INPH_filt_pass);
BOT_filt=zeros(280,1000,NUM_stacks);
for s=1:1:(NUM_stacks-1)
BOT_stack=imcrop3(BOT_crop,[1,1,INPH_filt_pass(s),999,279,(INPH_filt_pass(s+1)-1)]);
BOT_max=max(BOT_stack,[],3);
BOT_filt(:,:,s)=BOT_max;
end
navid alemi
el 2 de Mayo de 2015
0 votos
Hi Joy
would you please let me know how you figure it out I have the same problem.
thank you in advance
2 comentarios
Image Analyst
el 2 de Mayo de 2015
Is there something about the max() function you don't understand?
Walter Roberson
el 4 de Mayo de 2015
I gave complete code in my answer. The method Joy followed of doing each color plane independently and then combining the results does not give the maximum intensity because the different color planes do not contribute equally to intensity.
Categorías
Más información sobre Image Processing Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!