필터 지우기
필터 지우기

How do I convert the four dimension arrays to 3 dimension variable ?

조회 수: 2 (최근 30일)
I read a dicom image which has 128 rows and 128 columns, a depth of 1, and each dicom has 72 frames. Like this 72 images
X(128,128,1,72);
Now I need to convert this four-dimensional variable to a 3 dimensional variable for doing volume rendering using isosurface. How do I reduce this dimension by using reshape or squeeze? Can any one help me?
projectdir = 'E:\SHIVA BACKUP\THYROID\P1\newcodes\data1\13002';
% y = length(projectdir);
y=72;
X = zeros(128, 128, 1, 72,'uint8');
p=1;
% Read the series of images.
thisfile = sprintf('IM_%d.dcm', p);
filename = fullfile( projectdir, thisfile );
imdata = dicomread(filename);
imsize = size(imdata);
if ~isequal( imsize, [128 128 1 72] )
fprintf('file is unexpected size %s instead of [128 128 1 72], skipping "%s"\n', mat2str(imsize), filename);
else
X(:, :, :, :) = imdata;
end
v=zeros(128,128,1,1);
v(128,128,1,1)=reshape(X,size);
isoval=-1.5;
y=72;
fig = figure();
ax = axes('Parent', fig);
hiso = patch( isosurface( v, isoval), ...
'Parent',ax,'FaceAlpha', 0.74, ...
'FaceColor',[0.1,0.75,0.65],'EdgeColor','none');
lighting(ax, 'phong');
lightangle(ax, 45, 30);
rotate3d(ax, 'on');
title( sprintf('p = %d', p) )

채택된 답변

KSSV
KSSV 2016년 12월 2일
편집: KSSV 2016년 12월 2일
X = rand(128,128,1,72);
[m,n,p,q] = size(X) ;
Y = reshape(X,m,n,q) ;
  댓글 수: 3
KSSV
KSSV 2016년 12월 2일
편집: KSSV 2016년 12월 2일
Image not attached..look at imshow(Y(:,:,i)) where i = 1.....q

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

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 12월 2일
Why not just do
X = squeeze(imdata);

카테고리

Help CenterFile Exchange에서 Scalar Volume Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by