简体   繁体   English

如何将DICOM图像保存为JPEG而不会丢失信息

[英]How to save DICOM image as JPEG without losing information

I have a dicom image that when I open it in MATLAB it is like this: 我有一个dicom图像,当我在MATLAB中打开它时,它是这样的:

在此输入图像描述

However when I see that via dicomviewer it is like this: 但是,当我通过dicomviewer看到它时,它是这样的:

在此输入图像描述

How can I save these dicom images without loosing their information in .jpeg format due to compression process? 如何在不因压缩过程而丢失.jpeg格式的信息的情况下保存这些dicom图像? I want to save the image so that I can retrieve the same information as I get from the respective dicom image. 我想保存图像,以便我可以从相应的dicom图像中检索相同的信息。 Is it possible? 可能吗?

DICOM image data is typically stored as 16-bit unsigned integers, so you'll want to make sure that your image is stored within a uint16 matrix prior to saving so MATLAB knows to save it as such. DICOM图像数据通常存储为16位无符号整数,因此您需要确保在保存之前将图像存储在uint16矩阵中,以便MATLAB知道如何保存它。 Also, for some image formats, MATLAB requires that we explicitly state the bit depth. 此外,对于某些图像格式,MATLAB要求我们明确说明位深度。

% Save as a 16-bit Baseline JPEG with the highest quality
imwrite(uint16(data), 'image.jpg', 'Quality', 100, 'BitDepth', 16);

% Save as a 16-bit Lossless JPEG
imwrite(uint16(data), 'image.jpg', 'Mode', 'lossless', 'BitDepth', 16)

% Save as a 16-bit JPEG 2000 Image
imwrite(uint16(data), 'image.jp2', 'Mode', 'lossless')

If you don't need a JPEG for any particular reason, I would recommend a PNG (lossless). 如果您因任何特殊原因不需要JPEG,我建议使用PNG(无损)。

% Save as 16-bit PNG
imwrite(uint16(data), 'image.png')

See the full list of available 16-bit formats here . 请在此处查看可用的16位格式的完整列表。

For visualization in MATLAB, you can specify the second input to imshow (or use imagesc ) to automatically scale the displayed gray scale values to the data within the image 对于MATLAB中的可视化,您可以指定第二个输入来imshow (或使用imagesc )以自动将显示的灰度值缩放到图像中的数据

imshow(data, [])    % or imagesc(data); axis image;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM