Question about DcmFileFormat

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
paolom
Posts: 169
Joined: Tue, 2008-09-16, 15:02

Question about DcmFileFormat

#1 Post by paolom »

Does the DcmFileFormat let the Dicom File open for all its lifetime??

For example... if I try the loadFile(), does the DcmFileFormat create a reference of a file...or it close the file (after its costruction)?!?

Another example to understand...

If I create a DcmFileFormat with loadFile() from a Dicom on a CD and during its lifetime I extract the CD...does the application fail or the structure of the DcmFileFormat after its construction has not reference with the DICOM file on the CD??

Very thanks

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1461
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

Does the DcmFileFormat let the Dicom File open for all its lifetime??
No, it does not. Once it has parsed the DICOM object (e.g., executed DcmFileFormat::loadFile), the file will be closed. It is the task of the programmer to make sure that nobody renames, changes or deletes the file as long as DcmFileFormat may require access to load larger attribute values (such as pixel data). If you cannot guarantee that, call DcmFileFormat::loadAllDataIntoMemory() - after that, the DcmFileFormat object will never again have to open that very file, but if the file is very large, you might be in a different kind of trouble.
If I create a DcmFileFormat with loadFile() from a Dicom on a CD and during its lifetime I extract the CD...does the application fail or the structure of the DcmFileFormat after its construction has not reference with the DICOM file on the CD??
The application will fail. In such a case, you should either copy the file to harddisk first (which I would prefer also performance-wise), or use loadAllDataIntoMemory().

Post Reply

Who is online

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