Montage reshape produces white images
古いコメントを表示
Hello,
I'm following an example to create a montage of from an array of dicom files. Everything is working from reading the files, etc. The problem arises as the example wants to reshape the image and when it does, the entire montage is blank (white). I can reproduce the individual dicom images with matlab and it shows the correct image. Just when entered into this example is when the error arises.
I understand that also 'DisplayRange' can make pictures white if the wrong LOW and HIGH parameters are set, so I tried the same montage with 'Size' and it still comes out white.
Here is the code:
if true
% code
fileFolder = fullfile(pwd, 'DICOM');
files = dir(fullfile(fileFolder, '*.dcm'));
fileNames = {files.name};
info = dicominfo(fullfile(fileFolder,fileNames{1}));
SliceThickness=1;
PixelSpacing=[1;1];
voxel_size = [PixelSpacing; SliceThickness];
numImages = length(fileNames);
hWaitBar = waitbar(0,'Reading DICOM files');
AcquisitionMatrix=[0;256;256;0];
X = zeros(info.Rows, info.Columns, numImages, class(AcquisitionMatrix));
for i=length(fileNames):-1:1
fname = fullfile(fileFolder, fileNames{i});
X(:,:,i) = uint16(dicomread(fname));
waitbar((length(fileNames)-i+1)/length(fileNames))
end
delete(hWaitBar)
montage(reshape(uint16(X), [size(X,1), size(X,2), 1, size(X,3)]),'Size',[5 5]);
end
Why does it need to reshape? Can this be omitted.
Any help would be greatly appreciated. Thank you.
Cheers, Edwin
1 件のコメント
Edwin Baldelomar
2012 年 7 月 10 日
回答 (1 件)
カテゴリ
ヘルプ センター および File Exchange で DICOM Format についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!