How can I visualize 3D matrix? (extension of imagesc)

조회 수: 130 (최근 30일)
Jooeun Yoon
Jooeun Yoon 2020년 3월 6일
답변: Rajani Mishra 2020년 3월 9일
I have a 3-D matrix such as 50x70x30 like below.
(This image is from the Mathworks document)
Each slice(rowxcolumn) has cells with the range of 0 to 5. I want to visualize the whole slices with color range like imagesc in 2D, but I couldn't find the appropriate built-in function in MATLAB to represent the whole slices in a figure (For example, just imagine there are 30 slices of 2D imagesc(matrix) aligned in x-direction). Is there any way that I can solve this problem?
  댓글 수: 4
Adam
Adam 2020년 3월 6일
You only need one. Take a look at the example. It creates X, Y, Z grids using meshgrid to provide positional volumes, but there is only 1 actual volume with data that you are visualising.
Jooeun Yoon
Jooeun Yoon 2020년 3월 7일
Yes, but the x,y,z grids from meshgrid in the example are including the axis(points) infortmation and the volume equation in order to visualize the information. The 3-D matrix that I have is generating a cell with random number(0~5) with each iteration so that there are '30' slices of 2D matices with randomly generating field. I think 'doc slice' is only used for the grid that have the axis information, but mine doesn't include it.

댓글을 달려면 로그인하십시오.

답변 (1개)

Rajani Mishra
Rajani Mishra 2020년 3월 9일
For visualizing the slices of a 3D matrix, you can try one of the below methods:
  • imshow3D function displays images in a slice by slice fashion. Refer below code:
A = [1 2 3; 4 5 6; 7 8 9];
A(:,:,2) = [10 11 12; 13 14 15; 16 17 18]
imshow3D(A);
This displays all the two slices of the image matrix. For more information refer below:
  • You can create slices from the image matrix and use imagesc function on the 2D image generated
image2D = squeeze(A(:,:,sliceNumber));
imagesc(image2D);

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by