ReferencedFileID

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
daniele
Posts: 4
Joined: Fri, 2005-07-29, 12:05

ReferencedFileID

#1 Post by daniele »

I don't find the function ( in DCMTK ) that insert in file dicomdir the tag ReferencedFileID ( path to file dicom.dcm)

who can help me?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

The value of this tag is specified as a parameter of the DcmDirectoryRecord constructor.

Btw, why don't you use the wrapper class DicomDirInterface (see FAQ #30).

ecoto
Posts: 14
Joined: Thu, 2006-03-23, 13:34

#3 Post by ecoto »

Hi all, I know this is an old post but it closely related to my problem.

I'm using class DicomDirInterface just as described in FAQ #30 and I'm having problem with the ReferencedFileID in the DICOMDIR file.

My problem is due to the fact that the DICOMDIR file is in a directory (let's say C:\temp\) other than where the dicom images are (let's say C:\temp\patient\).

The DICOMDIR creation is sucessfull with a code very similar to the one in the FAQ, but then if I try to load the DICOMDIR file I get that the ReferencedFileID of the dicom files doesn't include the "patient\" needed to locate the images. i.e., it doesn't include the full path of the dicom file. The ReferencedFileID is always the name of the file (such as "IMG_0001"). According to the standard I should be able to specify the full path of the file ... isn't it ?.

The code is more or less the following (in kind of a pseudo-code):

pDicomdir->createNewDicomDir(AP_GeneralPurpose,"C:\\temp\\DICOMDIR");
m_pDicomdir->enableMapFilenamesMode();
for (all files in"C:\\temp\\patient\\")
{

pDicomdir->addDicomFile(FilePath, "C:\\temp\\patient\\");

}
m_pDicomdir->writeDicomDir();

How can I solve this problem ?

Thanks in advance,

ecoto

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

According to the DICOM standard you cannot store the full (= absolute) path in the DICOMDIR, but only the relative path. Just specify the the relative path (incl. the filename) as the first parameter ("filename") of DicomDirInterface::addDicomFile(). The optional second parameter ("directory") can be used when the DICOM file is not (yet) stored in the final directory. See documentation for details.

ecoto
Posts: 14
Joined: Thu, 2006-03-23, 13:34

#5 Post by ecoto »

Hi Jörg,

I'm aware of the fact that you can only store the relative path of the file. Nevertheless, as you can see in my previous post, if the DICOMDIR file is stored in "C:\temp\" and the files in "C:\temp\patient\", then the file name would be, e.g., "patient\IMG_0001" (or ".\patient\IMG_0001"). When I use such a file name in the addDicomFile() method, then I get an "Illegal parameter" error, since the filename has more than 8 characters as well as it contains invalid characters.

Now, I already fixed it, by re-opening the DICOMDIR using a DcmDicomDir object and going through the file changing the ReferencedFileID of the appropiate records.

Is there any other way to fix it without re-opening the file ?

Regards,

ecoto

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#6 Post by Jörg Riesmeier »

Are you sure that the problem is not caused by the fact that the subdirectory "patient" uses lower case characters (which is not allowed according to the DICOM standard)?

Btw, I just tried the following with dcmgpdir (which also uses the DicomDirInterface) and it worked as expected:

Code: Select all

dcmgpdir --verbose --input-directory c:\temp\ --recurse

ecoto
Posts: 14
Joined: Thu, 2006-03-23, 13:34

#7 Post by ecoto »

Yep, you were right. It works now. I can't believe I missed that.

Thanks,

ecoto

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest