MATLAB Answers

stack multiple 2D images

8 ビュー (過去 30 日間)
Turbulence Analysis
Turbulence Analysis 2021 年 5 月 21 日
回答済み: Tim 2021 年 5 月 21 日
I have 2D images pertaining to different Z positions (lets say 10 mm, 20 mm, 30 mm etc), Now I would like to stack images belongs to all Z positions on the single plot.. Could some one help how to do this ??
Right now, I plotting the image indivdual 2D image as follows
imagesc (x,y,B); % Where B is the matrix which got the intensity values

回答 (2 件)

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 5 月 21 日
Unfortunately matlab is a bit weak when it comes to displaying volumetric data. You can use the slice function and use the alpha-parameters to modify the transparency. Something like this:
for iZ = nZ:-1:1
V(:,:,iZ) = Bcell{iZ}; % just to get all the images into a 3-D array
idx_X = [12 37]; % Just example slices
idx_Y = [13 29];
idx_Z = [2 7];
ph = slice(X,Y,Z,V,idx_X,idx_Y,idx_Z),shading flat
and then setting the alpha and face-alpha-properties of ph (I have had some success using this earlier, when toying with this today, not so fortunate).
There's also a number of submissions on the FEX:

Tim 2021 年 5 月 21 日
Matlab's volume visualization got a big boost with volshow a couple years ago, if you have the image processing toolbox. Using the volume V from the comment above, use:
There's a lot of rendering options. For example, I frequently prefer using a MIP's on a black background. E.g. try:
volshow(randn(100, 100, 100), 'Renderer', 'MaximumIntensityProjection', 'BackgroundColor', [0, 0, 0]);
It's tricker to visualize volume data if you have RGB voxels but there are some FEX options out there.

Community Treasure Hunt

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

Start Hunting!

Translated by