GDCM:实现读取DICOM属性并打印
下面是一个使用GDCM库读取DICOM文件属性并打印它们的示例代码:
#include <iostream>
#include "gdcmReader.h"
#include "gdcmFile.h"
#include "gdcmDataSet.h"
#include "gdcmAttribute.h"
int main(int argc, char *argv[])
{
if (argc < 2)
{
std::cerr << "Usage: " << argv[0] << " <DICOM file>" << std::endl;
return 1;
}
const char *filename = argv[1];
gdcm::Reader reader;
reader.SetFileName(filename);
if (!reader.Read())
{
std::cerr << "Could not read: " << filename << std::endl;
return 1;
}
const gdcm::File &file = reader.GetFile();
const gdcm::DataSet &ds = file.GetDataSet();
// Example of retrieving patient name
std::string patientName;
if (gdcm::Attribute<0x0010, 0x0010>::GetValue(ds,
标签:并打印,读取,int,DICOM,源码,GDCM,include
From: https://blog.csdn.net/it_xiangqiang/article/details/136665134