Not the correct color on volshow

10 次查看(过去 30 天)
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 :)

采纳的回答

Sufiyan
Sufiyan 2023-4-27
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 个评论
Matteo Bonhomme
Matteo Bonhomme 2023-10-9
Hello,
Sorry for coming back to you after so long.
This is helping thank you :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Red 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by