我的3D体积为itkImage<unsigned char, 3>
,并且要将其保存为DICOM系列。到目前为止,保存该系列仍然有效,但是元数据标签“图像位置患者”和“图像方向患者”未保存在dicom文件中。所有其他标签均已正确保存。
如果我将元数据字典打印到控制台,则这些标记将正确打印。当我在ITK-SNAP中打开文件时,这两个标签是Missin。
0010 | 0010患者
0010 | 0020 12345
0020 | 0032 0 \ 0 \ 0
0020 | 0037 1 \ 0 \ 0 \ 0 \ 1 \ 0
这是这些标签存储在元数据中的代码部分。我创建了带有工作示例的gist。
UC3ImageType::PointType position;
UC3ImageType::IndexType index;
index[0] = 0;
index[1] = 0;
index[2] = f;
image->TransformIndexToPhysicalPoint(index, position);
value.str("");
value << position[0] << "\\" << position[1] << "\\" << position[2];
itk::EncapsulateMetaData<std::string>(*dictionary, "0020|0032", value.str());
value.str("");
value << position[2];
itk::EncapsulateMetaData<std::string>(*dictionary, "0020|1041", value.str());
itk::EncapsulateMetaData<std::string>(*dictionary, "0020|0037", "1\\0\\0\\0\\1\\0");
此代码有什么问题?是否还需要其他标签,以便也保存这些标签?
最佳答案
我可以通过指定其他SOP类UID来解决该问题。默认情况下,它使用Secondary Capture IOD,我将其更改为Ultrasound Multi Frame,这也更适合我的图像。现在,图像方向/位置已正确存储。
const std::string SOP_CLASS_UID = "0008|0016";
const std::string US_MULTIFRAME_UID = "1.2.840.10008.5.1.4.1.1.3.1";
itk::EncapsulateMetaData<std::string>(*dictionary, SOP_CLASS_UID, US_MULTIFRAME_UID);
但是,对我来说,仍然很奇怪,当由于某种原因未保存元数据标签时,没有警告或异常。