Dicom:Matlab与ImageJ灰度级 [英] Dicom: Matlab versus ImageJ grey level

查看:358
本文介绍了Dicom:Matlab与ImageJ灰度级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ImageJ和Matlab处理一组DICOM图像。
为了进行处理,我需要在8位深度版本的图像中找到灰度级介于110和120之间的斑点。



问题是:Matlab和ImageJ向我显示的图像是不同的,使用相同的源文件。
我假设其中一个人在阅读时或显示之前在其灰度级执行某种转换。但是其中哪一个呢?
在这种情况下,如何进行校准以使它们显示相同的图像?



下图显示了图像读取的比较。
对于imageJ,我只是打开了应用程序并打开了DICOM图像。



在第二种情况下,我使用了以下MATLAB脚本: / p>

[image] = dicomread('I1400001');

  figure (1)
imshow(image,[]);
title('Original DICOM image');



那么哪一个正在更改原始图像,如果是这种情况,我该如何修改以使两个版本看起来相同?

解决方案

看来默认情况下ImageJ使用窗口中心和窗口宽度标记在DICOM标题中对原始像素数据执行窗口和水平对比度调整,而MATLAB代码使用全部数据用于显示。取自 ImageJ用户指南


16 DICOM图像的显示范围



使用DICOM图像,ImageJ设置基于 Window Center (0028,1050)和
窗口宽度(0028,1051)标签的
初始显示范围。点击W& L或B& C窗口中的重置,显示范围将设置为最小和最大
像素值。


因此,将ImageJ设置为使用全范围的像素值应该会为您提供与MATLAB中显示的图像相匹配的图像。或者,您可以使用 dicominfo 在MATLAB中从标题中获取这两个标记值,然后在显示之前对数据应用窗口/调平。您的代码可能看起来像这样(使用上面第一个链接中的公式):

  img = dicomread('I1400001' ); 
imgInfo = dicominfo('I1400001');
c = double(imgInfo.WindowCenter);
w = double(imgInfo.WindowWidth);
imgScaled = 255。*((double(img) - (c-0.5))/(w-1)+0.5); %重新缩放数据
imgScaled = uint8(min(max(imgScaled,0),255)); %剪辑边缘

注意1) double 用于转换为双精度以避免整数运算,2)假设数据是无符号8位整数(这是结果转换回来的),以及3)我没有使用变量名 image 因为已有一个具有该名称的函数。 ;)


I am processing a group of DICOM images using both ImageJ and Matlab. In order to do the processing, I need to find spots that have grey levels between 110 and 120 in an 8 bit-depth version of the image.

The thing is: The image that Matlab and ImageJ shows me are different, using the same source file. I assume that one of them is performing some sort of conversion in the grey levels of it when reading or before displaying. But which one of them? And in this case, how can I calibrate do so that they display the same image?

The following image shows a comparison of the image read. In the case of the imageJ, I just opened the application and opened the DICOM image.

In the second case, I used the following MATLAB script:

[image] = dicomread('I1400001');

figure (1)
imshow(image,[]);
title('Original DICOM image');

So which one is changing the original image and if that's the case, how can I modify so that both version looks the same?

解决方案

It appears that by default ImageJ uses the Window Center and Window Width tags in the DICOM header to perform window and level contrast adjustment on the raw pixel data before displaying it, whereas the MATLAB code is using the full range of data for the display. Taken from the ImageJ User's Guide:

16 Display Range of DICOM Images

With DICOM images, ImageJ sets the initial display range based on the Window Center (0028, 1050) and Window Width (0028, 1051) tags. Click Reset on the W&L or B&C window and the display range will be set to the minimum and maximum pixel values.

So, setting ImageJ to use the full range of pixel values should give you an image to match the one displayed in MATLAB. Alternatively, you could use dicominfo in MATLAB to get those two tag values from the header, then apply window/leveling to the data before displaying it. Your code will probably look something like this (using the formula from the first link above):

img = dicomread('I1400001');
imgInfo = dicominfo('I1400001');
c = double(imgInfo.WindowCenter);
w = double(imgInfo.WindowWidth);
imgScaled = 255.*((double(img)-(c-0.5))/(w-1)+0.5);  % Rescale the data
imgScaled = uint8(min(max(imgScaled, 0), 255));      % Clip the edges

Note that 1) double is used to convert to double precision to avoid integer arithmetic, 2) the data is assumed to be unsigned 8-bit integers (which is what the result is converted back to), and 3) I didn't use the variable name image because there is already a function with that name. ;)

这篇关于Dicom:Matlab与ImageJ灰度级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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