How to improve lighting in volshow?
11 views (last 30 days)
Show older comments
Hi, I've currently got a volume in volshow with the renderer set to 'Isosurface'.
However, there's a small problem in viewing the model:
The lighting in volshow is not ideal, coming only from one direction, and I can't adjust any light properties or manipulate it.
Is there anything I can do make the lighting move with the movement of the model, such as camlight, when utilising volshow?
Here is the code for displaying volshow:
volshow(binary_stack,config1,'ScaleFactors',[(0.1*resolution) (0.1*resolution) (layerHeight*imageSkip)], 'Parent', p1);
volshow(binary_stack_supp,config1,'ScaleFactors',[(0.1*resolution) (0.1*resolution) (layerHeight*imageSkip)], 'Parent', p2);
And here is the config:
config1.CameraPosition = [0.0920,0.0910,0.0366];
config1.CameraUpVector = [0.0925,0.1054,0.9901];
config1.CameraTarget = [0,0,0];
config1.CameraViewAngle = 15;
config1.BackgroundColor = [1,1,1];
config1.Renderer = 'Isosurface';
config1.IsosurfaceColor = [0.502,0.502,0.502];
config1.Isovalue = 0.512222229003906;
config1.Lighting = true;
0 Comments
Answers (3)
yanqi liu
on 28 Sep 2021
Edited: yanqi liu
on 28 Sep 2021
sir, please use the follow to test
h = volshow(binary_stack,config1,'ScaleFactors',[(0.1*resolution) (0.1*resolution) (layerHeight*imageSkip)], 'Parent', figure);
intensity = [-3024,-16.45,641.38,3071];
alpha = [0, 0, 0.72, 0.72];
color = ([0 0 0; 186 65 77; 231 208 141; 255 255 255]) ./ 255;
queryPoints = linspace(min(intensity),max(intensity),256);
alphamap = interp1(intensity,alpha,queryPoints)';
colormap = interp1(intensity,color,queryPoints);
set(h, 'colormap', colormap,'alphamap',alphamap)
0 Comments
yanqi liu
on 28 Sep 2021
Edited: yanqi liu
on 28 Sep 2021
sir,please check the follow code to get some information
clc; clear all; close all;
load('spiralVol.mat');
h = volshow(spiralVol);
figure(1);
f = getframe(gcf);
intensity = [-3024,-16.45,641.38,3071];
alpha = [0, 0, 0.72, 0.72];
color = ([0 0 0; 255 0 0; 0 255 0; 255 255 255]) ./ 255;
queryPoints = linspace(min(intensity),max(intensity),256);
alphamap = interp1(intensity,alpha,queryPoints)';
colormap = interp1(intensity,color,queryPoints);
set(h, 'colormap', colormap,'alphamap',alphamap)
figure(1);
f2 = getframe(gcf);
figure; imshow(frame2im(f))
figure; imshow(frame2im(f2))
0 Comments
See Also
Categories
Find more on Volume Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!