stack multiple 2D images

조회 수: 40 (최근 30일)
Turbulence Analysis
Turbulence Analysis 2021년 5월 21일
답변: Tim 2021년 5월 21일
Hi,
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
end
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:
HTH

Tim
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:
volshow(V);
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