I want to see all information in dicom file(e.g. patient name,age,sex,hospital name, device name, creation file, etc.)
I use this code:
Code: Select all
void getPatientInformation(const char* fileName)
{
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile(fileName);
if (status.good())
{
OFString patientsName, patientsAge, patientsBDate, patientsSex, patientsAddress, deviceDescription;
fileformat.getDataset()->findAndGetOFString(DCM_PatientsName, patientsName);
fileformat.getDataset()->findAndGetOFString(DCM_PatientsAge, patientsAge);
fileformat.getDataset()->findAndGetOFString(DCM_PatientsBirthDate, patientsBDate);
fileformat.getDataset()->findAndGetOFString(DCM_PatientsSex, patientsSex);
fileformat.getDataset()->findAndGetOFString(DCM_PatientsAddress, patientsAddress);
fileformat.getDataset()->findAndGetOFString(DCM_DeviceDescription, deviceDescription);
cout << "Hastanin Adi: " << patientsName << endl;
cout << "Hastanin Yasi: " << ((patientsAge == "") ? "bos" : patientsAge.substr(1, 2)) << endl;
cout << "Hastanin Cinsiyeti: " << ((patientsSex == "M") ? "Erkek" : "Kadin") << endl;
cout << "Hastanin Adresi: " << ((patientsAddress == "") ? "bos" : patientsAddress) << endl;
cout << "Hastanin Dogum Tarihi: " << ((patientsBDate == "" ) ? "bos" : patientsBDate) << endl;
cout << "Cihaz bilgileri: " << ((deviceDescription == "") ? "bos" : deviceDescription) << endl;
}
else
cerr << "Error: cannot read DICOM file (" << status.text() << ")" << endl;
}
Otherwise I think writing class about this scenario.
Warm regards