How to convert a DICOM file format to RGB file format?
14 views (last 30 days)
Show older comments
Govindhan Per
on 12 Nov 2017
Commented: Walter Roberson
on 29 Dec 2017
Using DICOM file format we can't
0 Comments
Accepted Answer
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
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
More Answers (0)
See Also
Categories
Find more on DICOM Format in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!