std::string
FindDicomTag(const std::string & entryId,
{
std::string tagvalue;
const bool found = dicomIO->GetValueFromTag(entryId, tagvalue);
if (!found)
{
tagvalue = "NOT FOUND";
}
return tagvalue;
}
int
main(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "Usage: " << argv[0] << " DicomFile " << std::endl;
return EXIT_FAILURE;
}
using PixelType = short;
reader->SetFileName(argv[1]);
reader->SetImageIO(dicomIO);
try
{
reader->Update();
}
{
std::cout << ex << std::endl;
return EXIT_FAILURE;
}
const std::string patientName = FindDicomTag("0010|0010", dicomIO);
const std::string patientID = FindDicomTag("0010|0020", dicomIO);
const std::string patientSex = FindDicomTag("0010|0040", dicomIO);
const std::string patientAge = FindDicomTag("0010|1010", dicomIO);
const std::string studyDate = FindDicomTag("0008|0020", dicomIO);
const std::string modality = FindDicomTag("0008|0060", dicomIO);
const std::string manufacturer = FindDicomTag("0008|0070", dicomIO);
const std::string institution = FindDicomTag("0008|0080", dicomIO);
const std::string model = FindDicomTag("0008|1090", dicomIO);
std::cout << "Patient Name : " << patientName << std::endl;
std::cout << "Patient ID : " << patientID << std::endl;
std::cout << "Patient Sex : " << patientSex << std::endl;
std::cout << "Patient Age : " << patientAge << std::endl;
std::cout << "Study Date : " << studyDate << std::endl;
std::cout << "Modality : " << modality << std::endl;
std::cout << "Manufacturer : " << manufacturer << std::endl;
std::cout << "Institution : " << institution << std::endl;
std::cout << "Model : " << model << std::endl;
return EXIT_SUCCESS;
}