Hi,
I've just started to use DCMTK and have a few questions regarding the first step: reading a file.
1. Is there a way to read a file really lazy? It seems DcmFileFormat::read and DcmFileFormat::loadFile reads more than just the header.
2. When you copy a DcmFileFormat object, is it a shallow copy? Is it only stream state information that is copied or should I be careful and pass them around as references?
3. Is there anyway to use a std::istream instead of DcmInputStream? Or is it possible to implement the DcmInputStream interface or perhaps use the DcmProducer interface?
Thank you
Daniel
Newbie questions on DcmFileFormat and DcmInputStream
Moderator: Moderator Team
-
- DCMTK Developer
- Posts: 2049
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Re: Newbie questions on DcmFileFormat and DcmInputStream
Hi Daniel,
If you want more control over huge values (ie. you dont want them to be loaded complety into memory on access), you can use DcmElement's getPartialValue() on each DICOM element, e.g. Pixel Data.
Best regards,
Michael
DCMTK automatically does lazy loading in terms of not loading all data (element values) into memory. The decision whether to load an element's value into memory is based on a threshold. This is the maxReadLength parameter in DcmFileformat::loadFile() which defaults to 4 kiloybte. Once an element's value is accessed on later occassion, it's automatically loaded into memory. It's also possible to explicitly unload it again, calling compact() on that element (or compacElements() on the whole dataset/item).1. Is there a way to read a file really lazy? It seems DcmFileFormat::read and DcmFileFormat::loadFile reads more than just the header.
If you want more control over huge values (ie. you dont want them to be loaded complety into memory on access), you can use DcmElement's getPartialValue() on each DICOM element, e.g. Pixel Data.
The assignment operator performs a deep copy.2. When you copy a DcmFileFormat object, is it a shallow copy? Is it only stream state information that is copied or should I be careful and pass them around as references?
I don't think it's possible, but maybe one of my DCMTK colleagues knows better.3. Is there anyway to use a std::istream instead of DcmInputStream? Or is it possible to implement the DcmInputStream interface or perhaps use the DcmProducer interface?
Best regards,
Michael
-
- OFFIS DICOM Team
- Posts: 318
- Joined: Mon, 2014-03-03, 09:51
- Location: Oldenburg, Germany
Re: Newbie questions on DcmFileFormat and DcmInputStream
Nothing is impossible. You are on the right track: just derive your own class from DcmInputStream and map
tell()
etc. to std::istream::tellg()
etc. I have some corrupted memory of having done that before myself for some reason, but I don't think anything is readily available for the general public. So, just go for it!Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest