How can I convert a DICOM image to a jpeg image or bmp image?

8 ビュー (過去 30 日間)
Said BOUREZG
Said BOUREZG 2015 年 2 月 27 日
編集済み: Rance Tino 2018 年 1 月 26 日
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 件のコメント
Walter Roberson
Walter Roberson 2017 年 1 月 26 日
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
Rance Tino 2018 年 1 月 26 日
編集済み: Rance Tino 2018 年 1 月 26 日

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

採用された回答

Image Analyst
Image Analyst 2015 年 2 月 27 日
Why do you need them in that form? You can read the DICOM images in to your m-file with dicomread() so why do you need to read them in from a BMP with imread()?
  11 件のコメント
Image Analyst
Image Analyst 2015 年 3 月 1 日
Regarding your "Answer", if you want it to be uint8(), use mat2gray():
image8 = uint8(255 * mat2gray(X));
imshow(image8, []);
Said BOUREZG
Said BOUREZG 2015 年 3 月 1 日
編集済み: Said BOUREZG 2015 年 3 月 1 日
Yes, it works, thank u very much sir.. I hope that you will find the Eternal happiness source Sorry I was not here to see your last answer.

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

その他の回答 (2 件)

Image Analyst
Image Analyst 2015 年 3 月 1 日
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 件のコメント
david martinez
david martinez 2017 年 7 月 1 日
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
Walter Roberson 2017 年 7 月 1 日
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
Said BOUREZG 2015 年 3 月 1 日
yes, imwrite() work, but the image (.bmp) can't appear, X matrix before imwrite values are int16 so the range is not 0 to 255, so here when I save it as bmp I see only black and white. the dicom image is attached, run it and tell me

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by