hi plz help me in this probleme i wont to créate a montage of dicom image with 26 images

조회 수: 1 (최근 30일)
s = dicomread('SE000005\IM00000.dcm'); [r c] = size(s);
X = repmat(int16(0), [256 256 0 25])
for i=1:26
filename = sprintf('SE000005\\IM0000%d.dcm', i);
X(:,:,1,i) = dicomread(filename);
end
montage(X,'displayrange',[]);
but
error in X(:,:,1,i) = dicomread(filename);(Subscripted assignment dimension mismatch.)
)

채택된 답변

Image Analyst
Image Analyst 2016년 4월 10일
Do you have the right dimensions? Looks like it must be a 4-D array. From the help:
montage(I) displays all the frames of a multiframe image array I in a single image object. I can be a sequence of binary, grayscale, or truecolor images. A binary or grayscale image sequence must be an M-by-N-by-1-by-K array. A truecolor image sequence must be an M-by-N-by-3-by-K array.
What does this say:
whos X
  댓글 수: 3
Image Analyst
Image Analyst 2016년 4월 10일
Well, there you go -- X is empty. You need to step through with the debugger to figure out why you're not reading in the files. Like, try using exist(). And try using the folder, even if it's pwd, and fullfile, like I did below:
filename = fullfile(pwd, sprintf('SE000005\\IM0000%d.dcm', i))
if ~exist(filename, 'file')
message = sprintf('Error: file does not exist:\n%s', filename);
uiwait(warndlg(message));
continue;
end
mima  zebouchi
mima zebouchi 2016년 4월 10일
편집: mima zebouchi 2016년 4월 10일
yes thanks it works i change X = repmat(int16(0), [256 256 r c]

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by