I'm using dcmtk to read dicom images and I have following attribute with the new samples :
我正在使用dcmtk读取dicom图像,新示例具有以下属性:
(0028,0004) Photometric Interpretation: MONOCHROME2
(0028,0010) Rows: 512
(0028,0011) Columns: 512
(0028,0030) Pixel Spacing: 0.4688\0.4688
(0028,0100) Bits Allocated: 16
(0028,0101) Bits Stored: 16
(0028,0102) High Bit: 15
(0028,0103) Pixel Representation: 1
(0028,0106) Smallest Image Pixel Value: 0
(0028,0107) Largest Image Pixel Value: 2732
(0028,1050) Window Center: 1366
(0028,1051) Window Width: 2732
I use the getOutputData(16) to read int16_t data. It's surprised me, because the values are negative near to -1*(2^16) and when I subtracted the values by 2^15 everything seems ok and I can see the images! :-(
我使用getOutputData(16)来读取int16_t数据。让我吃惊,因为附近的值是- 1 *(2 ^ 16)当我为2 ^ 15的价值减去一切都好,我可以看到图片!:-(
Now I have two questions :
现在我有两个问题:
- Why should I subtract the value 2^15 and it goes ok? There is no padding value available on image!
- 我为什么要减去价值2 ^ 15,它好吗?图像上没有填充值!
- In document of getOutputData, it's speaking about The rendered pixel data is alway unsigned.. What does it means specially when my image data is signed because the (0028,0103) attribute is saying it to me? If this method is not proper, so can I get real data by dcmtk?
- 在getOutputData文档中,它表示呈现的像素数据总是无符号的。当我的图像数据被签名时(0028,0103)属性对我说它意味着什么?如果这个方法不合适,我可以用dcmtk获取真实数据吗?
5 个解决方案
#1
3
The key is the Pixel Representation (0028,0106) data element.
关键是像素表示(0028,0106)数据元素。
PixelRepresentation = 0 -> unsigned
PixelRepresentation = 1 -> signed
In your case, you have a value of '1', so you must read and interpret the values as signed integers.
在本例中,值为“1”,因此必须读取并将值解释为有符号整数。
You can find additional information here.
你可以在这里找到更多的信息。
#2
2
Never used dcmtk, but it looks like you have to apply the slope/intercept parameters of the modality VOI in order to obtain the correct numbers.
从来没有使用过dcmtk,但是看起来您必须应用modality VOI的斜率/截距参数才能获得正确的数字。
See rescale slope and rescale intercept and Window width and center calculation of DICOM image.
DICOM图像的重比例尺斜率和重比例尺截距和窗宽以及中心计算。
#3
0
According to the documentation getOutputData applies the presentation VOI before rendering so you always get unsigned data. So, if you ask for 16 bit data you will get pixels ranging fron 0 to 65535, regardless of the min and max values specified in the dataset; this because the returned data is meant to be displayed, it is not the original data stored in the image. I think you should just right shift the values by 8 bits, or just ask for 8 bit data (even if the image is 16 bits): I don't think that your graphic card can handle 16 bits if grayscale anyway.
根据文档,getOutputData会在呈现之前使用表示VOI,因此您总是得到未签名的数据。所以,如果你要求16位数据,你会得到像素范围在0到65535之间,不管数据集中指定的最小值和最大值是多少;这是因为返回的数据是要显示的,它不是存储在图像中的原始数据。我认为您应该将值右移8位,或者只要求8位数据(即使图像是16位):我认为您的图形卡无论如何不能处理16位的灰度。
#4
0
the DICOM header says that data is stored in DICOM file as a signed value, but it looks like that the documentation says that getOutputData converts it to an unsigned value. so, try reading the output of getOutputData as an uint16_t instead of int16_t.
DICOM报头说数据存储在DICOM文件中作为一个有符号的值,但是看起来好像文档说getOutputData将它转换为一个无符号的值。因此,尝试将getOutputData的输出作为uint16_t而不是int16_t来读取。
#5
0
I found the answer. It had explained here by good offic developers. See the page 2. It's completely related to DCMTK toolkit.
我找到了答案。它是由优秀的开发人员在这里解释的。看到第二页。它与DCMTK工具包完全相关。
#1
3
The key is the Pixel Representation (0028,0106) data element.
关键是像素表示(0028,0106)数据元素。
PixelRepresentation = 0 -> unsigned
PixelRepresentation = 1 -> signed
In your case, you have a value of '1', so you must read and interpret the values as signed integers.
在本例中,值为“1”,因此必须读取并将值解释为有符号整数。
You can find additional information here.
你可以在这里找到更多的信息。
#2
2
Never used dcmtk, but it looks like you have to apply the slope/intercept parameters of the modality VOI in order to obtain the correct numbers.
从来没有使用过dcmtk,但是看起来您必须应用modality VOI的斜率/截距参数才能获得正确的数字。
See rescale slope and rescale intercept and Window width and center calculation of DICOM image.
DICOM图像的重比例尺斜率和重比例尺截距和窗宽以及中心计算。
#3
0
According to the documentation getOutputData applies the presentation VOI before rendering so you always get unsigned data. So, if you ask for 16 bit data you will get pixels ranging fron 0 to 65535, regardless of the min and max values specified in the dataset; this because the returned data is meant to be displayed, it is not the original data stored in the image. I think you should just right shift the values by 8 bits, or just ask for 8 bit data (even if the image is 16 bits): I don't think that your graphic card can handle 16 bits if grayscale anyway.
根据文档,getOutputData会在呈现之前使用表示VOI,因此您总是得到未签名的数据。所以,如果你要求16位数据,你会得到像素范围在0到65535之间,不管数据集中指定的最小值和最大值是多少;这是因为返回的数据是要显示的,它不是存储在图像中的原始数据。我认为您应该将值右移8位,或者只要求8位数据(即使图像是16位):我认为您的图形卡无论如何不能处理16位的灰度。
#4
0
the DICOM header says that data is stored in DICOM file as a signed value, but it looks like that the documentation says that getOutputData converts it to an unsigned value. so, try reading the output of getOutputData as an uint16_t instead of int16_t.
DICOM报头说数据存储在DICOM文件中作为一个有符号的值,但是看起来好像文档说getOutputData将它转换为一个无符号的值。因此,尝试将getOutputData的输出作为uint16_t而不是int16_t来读取。
#5
0
I found the answer. It had explained here by good offic developers. See the page 2. It's completely related to DCMTK toolkit.
我找到了答案。它是由优秀的开发人员在这里解释的。看到第二页。它与DCMTK工具包完全相关。