how to save multiple dicom images in a folder?

Sir,
I have 500 Dicom images in the folder. I will read image one by one and save all the images in another folder.
I can read the multiple images. But, how to save all the dicom images in another folder one by one.
Thank you.

 Respuesta aceptada

Stalin Samuel
Stalin Samuel el 13 de En. de 2015
Editada: Stalin Samuel el 13 de En. de 2015

1 voto

6 comentarios

Jothi
Jothi el 13 de En. de 2015
Thank you so much.
mohd akmal masud
mohd akmal masud el 6 de Nov. de 2017
Hi Jothi.
I have the problem to read multiple dicom images in a folder.
can you share with me the script and the command?
projectdir = '.'; %full name of directory images are in
dinfo = dir( fullfile(projectdir, '*.dcm') );
nfile = length(dinfo);
filenames = fullfile(projectdir, {dinfo.name});
dimages = cell(nfile,1);
for K = 1 : nfile
thisfile = filenames{K};
try
dimages{K} = dicomread(thisfile);
catch ME
fprintf('There was some problem reading file "%s", continuing anyhow\n', thisfile);
end
end
I did not assume that all of the files can be read or that all of the files will have images exactly the same size and same number of frames.
In the special case that the images are all readable and same amount of info, then
imgdims = ndims(dimages{1});
all_dimages = cat(imgdims+1, dimages{:});
This is the another way of reading multiple images in a folder.
dir_path = 'F:\sample_image\';
dir_path = strcat(dir_path,'\');
dirpath = strcat(dir_path,'*.dcm');
files = dir(dirpath);
file_names={files.name};
sf=size(file_names);
for ii=1:sf(2),
s1 = strcat(dir_path,char(file_names{ii}));
Input_Image=imread(s1);
end
Walter Roberson
Walter Roberson el 7 de Nov. de 2017
That is pretty much the same as what I showed, but only works on MS Windows; the version I posted works on all operating systems.
Also, the question was specifically about dicom images, which require dicomread() rather than imread()
r r
r r el 23 de Jul. de 2020
I have digital image data and want to extract it in a format .dicom??

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre DICOM Format en Centro de ayuda y File Exchange.

Preguntada:

el 13 de En. de 2015

Comentada:

r r
el 23 de Jul. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by