kitty
kitty

Reputation: 75

How to read a dicom file on matlab?

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 ?

`close all;
clear all;
clear all;
%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(:);
end `

Upvotes: 3

Views: 1426

Answers (1)

Markus Sabin
Markus Sabin

Reputation: 4013

I am not a matlab expert. However, you are apparently trying to read a volume which constitutes from multiple single-frame images. To do this, the Matlab documentation says that you need to use dicomreadVolume to do so. dicomreadVolume accepts a directory as input, reads all files in the directory and builds a 4D volumetric dataset from it.

Again, I am not too familiar with matlab, but I think your code to read the files should read:

P ='C:\Users\kitty\Dropbox\denoise_ksvd\ADNI';
X=dicomreadVolume(P);

Upvotes: 6

Related Questions