using multiselect uigetfile with dicomread
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Catherine Scott
el 31 de Jul. de 2013
Comentada: KS
el 7 de Jun. de 2017
I have been using uigetfile to select dicom images which I then want to read with the dicomread command (I am using the image processing toolbox and Matlab version R2012b). If I select a single file then my code works fine:
[name, pathname] = uigetfile('*.dcm', 'Select a reference DICOM file...', 'MultiSelect', 'on') ;
for count = 1 : numel(name)
imageref{count} = dicomread(name(count));
end
but for multiple files I get the error:
Error using dicomread>newDicomread (line 164)
The first input argument must be a filename or DICOM info struct.
Error in dicomread (line 80)
[X, map, alpha, overlays] = newDicomread(msgname, frames);
Error in register_CT (line 13)
imageref{count} = dicomread(name(count));
I know that for multiple selections on uigetfile the filenames are cell strings, but if I convert them to character strings using the following code:
imageref{count} = dicomread(char(name(count))) ;
Then I get the error:
Error using dicomread>getFileDetails (line 1378)
File "IM-0001-0001.dcm" not found.
Error in dicomread>newDicomread (line 173)
fileDetails = getFileDetails(filename);
Error in dicomread (line 80)
[X, map, alpha, overlays] = newDicomread(msgname, frames);
Error in register_CT (line 13)
imageref{count} = dicomread(char(name(count))) ;
Where am I going wrong?!
0 comentarios
Respuesta aceptada
Matt Kindig
el 31 de Jul. de 2013
Editada: Matt Kindig
el 31 de Jul. de 2013
You probably need to pass in the full path to your DICOM file to dicomread(). Try this:
for count = 1:numel(name)
imageref{count} = dicomread( fullfile(pathname, name{count}) );
end
1 comentario
KS
el 7 de Jun. de 2017
I also need to select multiple images and I have tried to used your code. Surprisingly, it works as I want.
So let say I select and read three images. How to calculate the average of these images?
Thank you.
Más respuestas (0)
Ver también
Categorías
Más información sobre DICOM Format en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!