简体   繁体   English

在 DCMTK 中显示 ImageType 的全部内容

[英]showing the full content of ImageType in DCMTK

I'm trying to read a number of Siemens DICOM images with DCMTK, some of which are mosaic images.我正在尝试使用 DCMTK 读取一些 Siemens DICOM 图像,其中一些是马赛克图像。 I'm looking for a quick way to find those.我正在寻找一种快速找到这些的方法。

What I can see with mosaic images is that this is specified in the ImageType tag, eg我可以看到马赛克图像是在 ImageType 标记中指定的,例如

$ dcmdump ${im0} | grep ImageType
(0008,0008) CS [ORIGINAL\PRIMARY\ASL\NONE\ND\NORM\MOSAIC] #  40, 7 ImageType

Most of the tags are easily read with findAndGetOFString() (or similar for floats etc), but if I do大多数标签很容易用findAndGetOFString() (或类似的浮点数等)读取,但如果我这样做

tmpdata->findAndGetOFString(DCM_ImageType, tmpstring);
std::cout << "image type: " << tmpstring << "\n";           

for DcmDataset* tmpdata and OFString tmpstring , then the content of tmpstring is only ORIGINAL so the rest of the value is never printed.对于DcmDataset* tmpdataOFString tmpstring ,则tmpstring的内容只是ORIGINAL的,因此该值的 rest 永远不会打印。

In dcmdump it is printed, but there the value of DCM_ImageType never seems to be stored in a string, which I do need it to be.在 dcmdump 中打印它,但DCM_ImageType的值似乎从未存储在字符串中,我确实需要它。

Would there be a similar command to findAndGetOFString() for 'code strings'?是否有类似的命令来查找“代码字符串”的findAndGetOFString() Maybe I'm missing something obvious!也许我错过了一些明显的东西!

Image Type (0008,0008) is a multi-valued attribute.图像类型 (0008,0008) 是一个多值属性。 That is, it may include several values which are separated by the backslash character.也就是说,它可能包含多个由反斜杠字符分隔的值。 Note, that "officially", the backslash is not part of the attribute's value.请注意,“正式”,反斜杠不是属性值的一部分。 It is a delimiter between several values of the attribute.它是属性的几个值之间的分隔符。 This is what you have.这就是你所拥有的。 So in terms of DICOM, there is no "one value" but multiple ones.所以就 DICOM 而言,没有“一个值”,而是多个值。 The DCMTK API allows you to handle this (of course). DCMTK API 允许您处理这个(当然)。

findAndGetOFString() has a third parameter ("index") to define which of the multiple values you want to obtain. findAndGetOFString()有第三个参数(“index”)来定义您想要获取的多个值中的哪一个。

The behavior that you probably expect is what findAndGetOFStringArray() does.您可能期望的行为是findAndGetOFStringArray()所做的。

As an alternative, you could iterate through the multiple values of the attribute by obtaining the "Value Multiplicity" first and then loop through the values like作为替代方案,您可以通过首先获取“值多重性”来遍历属性的多个值,然后遍历这些值,例如

DcmElement* element = tmpdata->findAndGetElement(DCM_ImageType);
int numberOfValues = element->getVM();
for(int index = 0; index < numberOfValues; index++)
{
    OFString valueAtIndex;
    element->GetOfString(valueAtIndex, index);
    /// ... your concatenation goes here...
}

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

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