problems accessing dicomdir

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
winniey
Posts: 8
Joined: Fri, 2011-11-25, 07:44

problems accessing dicomdir

#1 Post by winniey »

Hi,
I followed the steps the forum suggested to access dicomdir, but root->nextSub(PatientRecord)) turns to be NULL, then skip the loop, could you tell me what's possible reason of it? Thank you very much.

Code: Select all

   DcmDicomDir dicomdir(DIR_FilePath);
	DcmDirectoryRecord *root = &(dicomdir.getRootRecord());
	DcmDirectoryRecord *PatientRecord =NULL;
	DcmDirectoryRecord *StudyRecord = NULL; 
	DcmDirectoryRecord *SeriesRecord = NULL; 
	DcmDirectoryRecord *FileRecord = NULL; 
	OFString tmpString; 

	if(root != NULL) 
	{ 
		while (((PatientRecord = root->nextSub(PatientRecord)) != NULL)) 
		{ 
			if (PatientRecord->findAndGetOFString(DCM_PatientName, tmpString).good()) 
			{ 
			   cout << "Patient Name : " << tmpString << "\n"; 
			} 
			else 
			{ 
			   cerr << "Can't retrieve patient name from DICOMDIR file!\n"; 
			} 

			while (((StudyRecord = PatientRecord->nextSub(StudyRecord)) != NULL)) 
			{ 
			   if (StudyRecord->findAndGetOFString(DCM_StudyDescription, tmpString).good()) 
			   { 
				  cout << "Study Description : " << tmpString << "\n"; 
			   } 
			   else 
			   { 
				  cerr << "Can't retrieve study description from DICOMDIR file!\n"; 
			   } 

			   while (((SeriesRecord = StudyRecord->nextSub(SeriesRecord)) != NULL)) 
			   { 
				  if (SeriesRecord->findAndGetOFString(DCM_SeriesDescription, tmpString).good()) 
				  { 
					 cout << "Series Description : " << tmpString << "\n"; 
				  } 
				  else 
				  { 
					 cerr << "Can't retrieve series description from DICOMDIR file!\n"; 
				  } 
			   } 
			} 
		 } 
	  } 
[/code]

Rautenberg_ES
Posts: 6
Joined: Wed, 2011-09-28, 13:50

#2 Post by Rautenberg_ES »

My first guess is that the given path is wrong / not in the correct format / empty.

Roadrunner
Posts: 56
Joined: Mon, 2010-06-14, 16:41

#3 Post by Roadrunner »

Try to convert your dicomdir to xml so you can see the records and their values; not all values but most of them i. e. patient name.

Thats what i did as i implemented my dicomdir reading class.

Frank

winniey
Posts: 8
Joined: Fri, 2011-11-25, 07:44

#4 Post by winniey »

Find the reason ! There are some mistakes in the offset fields of my DICOMDIR file.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest