如何将16位深度灰度降级为8位深度图像(RGB 24) [英] How to downgrade 16 bit depth gray scale to 8 bit depth image (rgb 24)

查看:1930
本文介绍了如何将16位深度灰度降级为8位深度图像(RGB 24)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在WPF项目中工作.

So I am working in a WPF project.

我有两个DICOM图像(X射线(16位灰度)图像和光学(24位RGB)图像).

I have two DICOM Images(X-ray(16 bits gray scale) Image and an Optical(24 bit RGB) Image).

我想要的

我想通过更改不透明度将两个图像彼此融合.像增加或减少两个图像之间的不透明度.

I wanna blend the two image one on the another by changing opacity. Its like increase or decrease opacity between the two images.

如果我想混合这两个图像,我想做的就是将X射线图像降级为8位灰度.因此,它将在混合时匹配24位光学图像.

If I wanna blend these two images, what I wanted to do is downgrade the x-ray image to 8 bits gray scale. So the it will match the 24 bit optical image while blending.

我的问题

如何将16位灰度DICOM图像降级为8位深度(24位RGB).

How can I downgrade a 16 bits gray scale DICOM image to 8 bits depth (24 bits RGB).

我尝试过的事情

我试图使用PixelFormats降级图像.

I have tried to downgrade the image using PixelFormats.

stride = width * 4;
size = height * stride;
bitmapSource = BitmapImage.Create(width, height, 96, 96, System.Windows.Media.PixelFormats.Gray8, null, bitmapBuffer, stride);

但是,如果我尝试使用上面的代码,则生成的图像看起来很粗糙,并且有一些损失.我该怎么做才能保持图像的质量并同时对其进行降级.

But if I tried to use the above code the resulting image looks grainy and has some losses. What can I do to maintain the quality of the image and downgrade it at the same time.

请帮助我.我是图像处理和DICOM域的新手.

Please help me. I am a newbie to image processing and DICOM domain.

推荐答案

我认为没有机会使用任何Microsoft API.您应该考虑DICOM标头中的许多属性:

I do not see a good chance to use any Microsoft API for that. There are lots of attributes in the DICOM header that you should consider:

  • (0028,0101)已存储的位数告诉您像素数据使用的真实位位数.确保掩盖未使用的位-它们可能包含随机位
  • (0028,0004)光度解释会告诉您在缩小之前是否需要反转图像(MONOCHROME1-> Identity,MONOCHROME2-> Invert)
  • (0028,3000)模态LUT序列可能会指定应考虑的像素数据的非线性变换
  • (0028,0103)像素表示表示像素的二进制值是应解释为无符号整数还是2s补码有符号整数
  • (0028,0101) Bits Stored tells you the real number of bits used by the pixel data. Make sure to mask out unused bits - they might contain random bits
  • (0028,0004) Photometric Interpretation tells you whether you need to invert the image prior to downscaling (MONOCHROME1 -> Identity, MONOCHROME2 -> Invert)
  • (0028,3000) Modality LUT Sequence might specify a non-linear transformation of the pixel data that should be considered
  • (0028,0103) Pixel Representation tells whether the binary values of pixels are to be interpreted as unsigned integers or as 2s complement signed integers

下一个问题是:缩减规模的目标是什么

The next question is: What is the target of the downscaling

  • 原始像素数据保持不变-那么就可以将像素(可能由Modality LUT映射)重新缩放到新范围就可以了.
  • 医生应该感知的图像-然后需要考虑其他属性

在后一种情况下,适用以下转换

In the latter case the following transformations apply

    重新缩放坡度/截距(0028,1053)/(0028,1052)定义了像素数据到设备所测量值范围的线性变换.变换后像素值超过16位的情况很少见,但不禁止
  • 窗口中心/宽度(0028,1050)/(0028,1051)定义要映射到8位的像素数据的范围.可能会出现多个窗口/级别集,因此困难在于选择合适的窗口/级别.
  • Rescale Slope / Intercept (0028,1053) / (0028,1052) define a liniear transformation of the pixel data to the value range measured by the device. It is uncommon but not forbidden that the pixel values exceed 16 bit after the transformation
  • Window Center / Width (0028,1050) / (0028,1051) define the range of pixel data which are to be mapped to 8-bit. More than one Window/Level set may be present, so the difficulty will be to choose the appropriate one.

在明确说明此功能将被包含在交互式UI中之后,我建议: 通过组合定义如何解释像素数据的属性(请参见上文),将像素数据读取为本机"格式.您可以从此步骤获得中间表示,其中像素数据以32/64位无符号整数格式表示为来自设备的测量值. 然后从DICOM标头中选择第一个窗口/中心"集,以将缩小比例定义为8位(请参见

After it was clarified that this functionality is to be incorporated in an interactive UI, I recommend to: Read the pixel data to a "native" format by combining the attributes which define how the pixel data is to be interpreted (see above). You obtain an intermediate representation from this step in which the pixel data is represented as measured values from the device in 32/64 bit unsigned integer format. Then choose the first Window/Center set from the DICOM header to define the downscaling to 8 bit (see here). But allow the user to select other Window/Center sets from the header if present and allow her to adjust it manually.

这篇关于如何将16位深度灰度降级为8位深度图像(RGB 24)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆