Montage reshape produces white images

5 ビュー (過去 30 日間)
Edwin Baldelomar
Edwin Baldelomar 2012 年 7 月 10 日
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
Edwin Baldelomar 2012 年 7 月 10 日
Maybe insight on the image is needed. I can properly open up the dicom image via
if true
% code
[uint16,map]=dicomread('0005.dcm');
map=[256;256];
montage(uint16, map,'Size',[1 1]);
end

サインインしてコメントする。

回答 (1 件)

Edwin Baldelomar
Edwin Baldelomar 2012 年 7 月 10 日
Problem Solved. Even though I was either putting empty '[]' for 'DisplayRange' or the actual LOW and HIGH values in the brackets, the max was somehow defaulted at 100. I just went into the ColorMap editor and it allowed me to change it and I saw the images.
Maybe someone could explain why it defaulted at 100? Thank you.
Cheers, Edwin

カテゴリ

Help Center および File ExchangeDICOM Format についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by