필터 지우기
필터 지우기

Not the correct color on volshow

조회 수: 10 (최근 30일)
Matteo Bonhomme
Matteo Bonhomme 2023년 4월 19일
댓글: Matteo Bonhomme 2023년 10월 9일
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