All Information in DICOM File?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
berte
Posts: 5
Joined: Sun, 2008-03-16, 19:03

All Information in DICOM File?

#1 Post by berte »

Hello,

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;
	
}
But I think theese code useless. DCMTK has classes about this scenario ?
Otherwise I think writing class about this scenario.

Warm regards :)

Michael Onken
DCMTK Developer
Posts: 2072
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi,

If you want to print (see?) all informations in a DICOM file, use the print() method provided by DcmDataset. Output can be controlled using various parameters.
Or just use the tool dcmdump which is part of DCMTK ;) You can find it's source in the dcmdata/apps/ directory.

Regards,
Michael

berte
Posts: 5
Joined: Sun, 2008-03-16, 19:03

#3 Post by berte »

thanks :)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 0 guests