Volshow contrast or scaling the colormap

38 ビュー (過去 30 日間)
Brittney Gorman
Brittney Gorman 2020 年 10 月 14 日
コメント済み: Brittney Gorman 2020 年 10 月 29 日
Is there a way to scale the colormap in volshow()? Similar to using 'caxis', [min max] for image()?

採用された回答

Tim
Tim 2020 年 10 月 29 日
編集済み: Tim 2020 年 10 月 29 日
% Example volume
imcube = bsxfun(@power, rand(30, 30, 100),...
permute(linspace(0, 8, 100), [3, 1, 2])).*...
permute(linspace(1, 0, 100), [3, 1, 2]);
% Pick your color map
cmp = jet;
% Generate your volume object
V = volshow(imcube,...
'Renderer', 'MaximumIntensityProjection',...
'Colormap', cmp,...
'BackgroundColor', [0, 0, 0]);
% Set your new color axis. This does the same thing as caxis normally
% would.
% % % % % % % % % % % % CAXIS EQUIVALENT % % % % % % % % % %
VAxis = [0.2, 1.5];
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% Generate new scale
newscale = linspace(min(imcube(:)) - min(VAxis(:)),...
max(imcube(:)) - min(VAxis(:)), size(cmp, 1))/diff(VAxis);
newscale(newscale < 0) = 0;
newscale(newscale > 1) = 1;
% Update colormap in volshow
V.Colormap = interp1(linspace(0, 1, size(cmp, 1)), cmp, newscale);
  1 件のコメント
Brittney Gorman
Brittney Gorman 2020 年 10 月 29 日
This works! Thank you

サインインしてコメントする。

その他の回答 (1 件)

Pratyush Roy
Pratyush Roy 2020 年 10 月 27 日
Hi,
Assuming that the colormap generation is being a bit difficult, one can use the "ColorMap" property of the volshow() function to manually generate a colormap.
The following documentation link might be of further help:

Community Treasure Hunt

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

Start Hunting!

Translated by