I have a dicom file of size 256*256*3. However, when I read this file using dicomread command in matlab the size of the dicom file is 256*256? How to fix this ?

1 回表示 (過去 30 日間)
close all;
clear all;
clear all;
bb=8; % block size
RR=4; % redundancy factor
K=RR*bb^2; % number of atoms in the dictionary
%here we are reading the image and adding noise into that image.
sigma = 25;% standard deviation
P ='C:\Users\kitty\Dropbox\denoise_ksvd\ADNI';
D=dir(fullfile(P,'*.dcm'));
C=cell(size(D));
for k=1:numel(D)
C=dicomread(fullfile(P,D(k).name));
IMin0(:,k)=C(:);
  2 件のコメント
Stephen23
Stephen23 2018 年 3 月 12 日
編集済み: Stephen23 2018 年 3 月 12 日
@kitty Varghese: please show the outputs of these commands:
size(C)
info = dicominfo(fullfile(P,D(k).name));
info.ColorType
info.Width
info.Height
Note that this line is totally superfluous, as you redefine C on each loop iteration:
C = cell(size(D)); % this line does nothing!
for k = 1:numel(D)
C = dicomread(fullfile(P,D(k).name)); % because of this line.
...
end
kitty varghese
kitty varghese 2018 年 3 月 12 日
I updated the code and now my code is as shown below.
P = 'C:\Users\kitty\Dropbox\denoise_ksvd';
S = dir(fullfile(P,'ADNI','*.dcm'));
I = cell(1,numel(S));
for k = 1:numel(S)
I{k} = dicomread(fullfile(P,'ADNI',S(k).name));
end
M = cell2mat(cellfun(@(m)m(:),I(:).','uni',0));
then size(I)= 1 21
info = dicominfo(fullfile(P,'ADNI',S(k).name))
info.ColorType= grayscale
info.Width=256
info.Height=256

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

採用された回答

Stephen23
Stephen23 2018 年 3 月 12 日
編集済み: Stephen23 2018 年 3 月 12 日
According to the dicomread documentation "For single-frame grayscale images, X is an M-by-N array". In your response to my comment you wrote
info.ColorType= grayscale
so therefore I would expect the imported image to have size MxN, just as the dicomread help states. If all of the other images are also grayscale, then all of them will be 2D matrices. You can check this yourself in the loop.
In the original question title you wrote "I have a dicom file of size 256*256*3": how are you checking this? With what tool or command?

その他の回答 (0 件)

カテゴリ

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