loading just the meta header information

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
xargon
Posts: 15
Joined: Mon, 2007-04-30, 13:16

loading just the meta header information

#1 Post by xargon »

Hi everyone,

I am using the DCMTK library on Linux and have a need where I have to recursively scan and build volumes from files in a user specified directory. The problem is that I am running out of memory doing these scans.

To arrange the DICOM files, I only need the information from the headers.

I am loading the files as follows:

I have a DCMFileFormat object that it a class member:

Code: Select all

DcmFileFormat *         m_dcmFileFormat; 
To load the file, I am using:

Code: Select all

m_dcmFileFormat->loadFile(fileName, EXS_Unknown, EGL_noChange, DCM_MaxReadLength, ERM_fileOnly)
My question is does the loadFile statement load the whole file (with data) into the memory? If yes, is there a way to delay the loading unless the call is made to retrieve DCM_PixelData?

Cheers,
Luca

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

#2 Post by Michael Onken »

Hi Luca,
m_dcmFileFormat->loadFile(fileName, EXS_Unknown, EGL_noChange, DCM_MaxReadLength, ERM_fileOnly)
Your call loads all elements into memory that are larger than the size (in bytes) given by DCM_MaxReadLength. Usually this value is set to 4 KB so only elements (including pixel data element) are loaded having a value length of more than 4096 bytes. If you want to load bigger values per default, you can increment this threshold. For your purposes this should be a good default.

The last parameter in the loadFile() call denotes, whether DCMTK should try to parse a DICOM file that includes a meta header (which is the usual case) or a file without metaheader (which is what you choosed with ERM_fileOnly). Best choice for this option should be the value ERM_autoDetect to let DCMTK decide what to do. Only if you already know that your files do not contain metaheader information you should use ERM_fileOnly.

Regards,
Michael

xargon
Posts: 15
Joined: Mon, 2007-04-30, 13:16

#3 Post by xargon »

Hi Michael,

Thanks for the reply. You mention:
your call loads all elements into memory that are larger than the size (in bytes) given by DCM_MaxReadLength.
Don't you mean that all elements less than the size given by DCM_MaxReadLength are loaded?

Thanks,
Luca

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 »

Don't you mean that all elements less than the size given by DCM_MaxReadLength are loaded?
Yes, you are correct.

Another little mistake in Michael's posting: ERM_fileOnly does mean exactly the opposite, i.e. only DICOM files with meta header are loaded :-)

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

#5 Post by Michael Onken »

Hoppla..., of course it is correct, what Jörg points out...I'm so sorry :)
Michael

Post Reply

Who is online

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