How to convert a DICOM file format to RGB file format?

14 views (last 30 days)
Using DICOM file format we can't

Accepted Answer

Image Analyst
Image Analyst on 12 Nov 2017
Use dicomread(). It will give you the image inside the file, either in gray scale or color or whatever format it's stored in.
  2 Comments
Walter Roberson
Walter Roberson on 29 Dec 2017
TheData = dicomread('TheDicomFile.dcm');
if ndims(TheData) > 3
error('Dicom file is 4 or more dimensions and cannot be converted to a single RGB image')
end
if size(TheData,3) == 1
RGB_image = TheData(:,:,1);
elseif size(TheData,3) == 3
RGB_image = TheData;
else
error('Dicom file appears to be grayscale slices and cannot be converted to a single RGB image')
end

Sign in to comment.

More Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!