Not the correct color on volshow

7 views (last 30 days)
Hello,
I have this code
V_test=zeros(100,100,100);
V_test(10:20,10:20,10:20)=deal(1);
V_test(80:90,10:20,10:20)=deal(2);
V_test(45:55,45:55,45:55)=deal(3);
value=0:3;
color=[0,0,0;1,0,0;0,1,0;0,0,1];
queryPoints=linspace(min(value),max(value),256);
colormap = interp1(value,color,queryPoints);
figure(1)
myvol=volshow(V_test,Colormap=colormap);
I want the grey cube to be blue. It is blue on certain angle wich lead me to think it's a reflection issue but I'm not sure at all.
If anyone who's more familiar with volume rendering can help me that would be gratly appreciated :)

Accepted Answer

Sufiyan
Sufiyan on 27 Apr 2023
Hi,
You can refer to the below code.
V_test=zeros(30,30,30);
% first cube
V_test(10:20,10:20,10:20)=1;
% second cube
V_test(80:90,10:20,10:20)=2;
% third cube
V_test(45:55,45:55,45:55)=3;
value=0:3;
color=[0,0,0;0.2,0.8,0;0,0,1;1,0,0];
queryPoints=linspace(min(value),max(value),256);
colormap = interp1(value,color,queryPoints);
figure(1)
myvol=volshow(V_test,'Colormap',colormap);
% Change the rendering method to MIP
myvol.RenderingStyle = 'VolumeRendering';
% Adjust the view angle of the MIP projection
view([30,30]);
hope this helps!
  1 Comment
Matteo Bonhomme
Matteo Bonhomme on 9 Oct 2023
Hello,
Sorry for coming back to you after so long.
This is helping thank you :)

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!