How can I convert a DICOM image to a jpeg image or bmp image?
Mostrar comentarios más antiguos
In my project, I need an medical images in bmp form, but the problem they didn't exist with that form, so I must convert a DICOM image format to bmp, I have write the code but a problem stop when I want to save X,MAP obtained, X is int16, than what should I do?.
3 comentarios
Neerav Adhikari
el 26 de En. de 2017
Editada: Walter Roberson
el 26 de En. de 2017
Hope this helps you, I was looking for the same and found .
I = dicomread('IM (9).dcm');
[filename, pathname] = uigetfile('IM (9).dcm', 'Open DICOM Image');% Open only DICOM image
[X,MAP]=dicomread(fullfile(pathname, filename));
image8 = uint8(255 * mat2gray(X));
imwrite(image8,'MRI-IM.bmp', 'bmp');
C = imread ('MRI-IM.bmp');
imshow(C);
Walter Roberson
el 26 de En. de 2017
If the returned MAP is non-empty then you need to
X = ind2rgb(X, MAP);
If you are certain that the returned MAP will be empty then you should not return it as an output from DICOMREAD.
Rance Tino
el 26 de En. de 2018
Editada: Rance Tino
el 26 de En. de 2018
Or you could easily use this function https://au.mathworks.com/matlabcentral/fileexchange/65852-dicom2image-filename-imagetype-
Respuesta aceptada
Más respuestas (2)
Image Analyst
el 1 de Mzo. de 2015
Said, try this:
[filename, pathname] = uigetfile('*.dcm', 'Open DICOM Image');
if isequal(filename, 0) || isequal(pathname, 0)
uiwait(helpdlg('Image reading canceled.'));
else
[X,MAP]=dicomread(fullfile(pathname, filename));
subplot(1,2,1);
imshow(X, []);
title('16 bit image.', 'FontSize', 30);
% Convert to 8 bit.
image8 = uint8(255 * mat2gray(X));
subplot(1,2,2);
imshow(image8, []);
title('8 bit image.', 'FontSize', 30);
imwrite(image8,'myfile.bmp');
end
2 comentarios
david martinez
el 1 de Jul. de 2017
I get this error
Error using images.internal.imageDisplayValidateParams>validateCData (line 115) Multi-plane image inputs must be RGB images of size MxNx3.
Error in images.internal.imageDisplayValidateParams (line 27) common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 78) common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 240) images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});
Error in untitled111 (line 7) imshow(X, []);
the image is multiplanar, some idea
Walter Roberson
el 1 de Jul. de 2017
You cannot use imshow() to display more than 3 planes of a multiplanar image.
You need to use a volume viewer such as volumeViewer (R2017a or later), or you need to treat the planes as slices to be displayed, such as getting imdisp() or its follow-on SC from the File Exchange and using
imdisp(reshape(X, size(X,1), size(X,2), 1, size(X,3)))
Said BOUREZG
el 1 de Mzo. de 2015
0 votos
Categorías
Más información sobre Convert Image Type en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!