Reading massive files with dcm4che - DICOM

This is a discussion on Reading massive files with dcm4che - DICOM ; We need to be able to read large Enhanced MR files. These files are multi-frame and thus the pixel data element is massive (in some cases near 1GB). We can read these images by calling setValueLengthLimit on the DicomInputStream before ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Reading massive files with dcm4che

  1. Reading massive files with dcm4che

    We need to be able to read large Enhanced MR files. These files are
    multi-frame and thus the pixel data element is massive (in some cases
    near 1GB). We can read these images by calling setValueLengthLimit on
    the DicomInputStream before reading the DicomObject, but this results
    in the entire pixel data element being read into memory. This is not
    acceptable because of the massive amount of memory consumed.

    Is there a way to access the pixel data as a stream or to access the
    pixel data one frame at a time? Thanks in advance for your help.

    Brian

  2. Re: Reading massive files with dcm4che

    On May 23, 2:18*am, Brian wrote:
    > We need to be able to read large Enhanced MR files. These files are
    > multi-frame and thus the pixel data element is massive (in some cases
    > near 1GB). We can read these images by calling setValueLengthLimit on
    > the DicomInputStream before reading the DicomObject, but this results
    > in the entire pixel data element being read into memory. This is not
    > acceptable because of the massive amount of memory consumed.
    >
    > Is there a way to access the pixel data as a stream or to access the
    > pixel data one frame at a time? Thanks in advance for your help.
    >
    > Brian


    Guess you talk about dcm4che2 DICOM implementation. If so, you can
    register the StopTagInputHandler as DicomInputHandler on
    DicomInputStream before reading the DicomObject, to stop the reading
    from the InputStream just before the Pixel Data value. Or you can
    register your own implementation of DicomInputHandler, with

    public boolean readValue(DicomInputStream in) throws IOException {
    if ((in.tag() & 0xffffffffL) != Tag.PixelData || in.level() > 0) {
    return in.readValue(in);
    }
    // read out and process pixel data as you like
    ....
    return true;
    }

    There is also a dcm4che2 user forum:

    http://forums.dcm4che.org/jiveforums...jspa?forumID=5

    which seems more appropriate to discuss usage of dcm4che2.

    gunter

  3. Re: Reading massive files with dcm4che

    On May 22, 8:18*pm, Brian wrote:
    > We need to be able to read large Enhanced MR files. These files are
    > multi-frame and thus the pixel data element is massive (in some cases
    > near 1GB). We can read these images by calling setValueLengthLimit on
    > the DicomInputStream before reading the DicomObject, but this results
    > in the entire pixel data element being read into memory. This is not
    > acceptable because of the massive amount of memory consumed.
    >
    > Is there a way to access the pixel data as a stream or to access the
    > pixel data one frame at a time? Thanks in advance for your help.


    I faced the same problem when adding the enhanced multi-frame support
    to PixelMed, and my solution was to set a threshold beyond which the
    pixel data attribute contents were left on disk and not read into
    memory, and only when it was needed for display or processing, the
    pixel data itself was paged in from a memory mapped file on a frame-by-
    frame basis. This works pretty well depending on how you set up the
    balance of memory assigned to the Java heap and memory available to
    the entire process, which on some platforms (notably Windoze)
    constrains the size of memory-mapped files. Memory-mapped files are
    very cool, though Java's support for them has some weaknesses.

    I am sure Gunter could add a similar mechanism if there was a need.

    David

  4. Re: Reading massive files with dcm4che

    On May 23, 4:23 am, gunter zeilinger wrote:
    > On May 23, 2:18 am, Brian wrote:
    >
    > > We need to be able to read large Enhanced MR files. These files are
    > > multi-frame and thus the pixel data element is massive (in some cases
    > > near 1GB). We can read these images by calling setValueLengthLimit on
    > > the DicomInputStream before reading the DicomObject, but this results
    > > in the entire pixel data element being read into memory. This is not
    > > acceptable because of the massive amount of memory consumed.

    >
    > > Is there a way to access the pixel data as a stream or to access the
    > > pixel data one frame at a time? Thanks in advance for your help.

    >
    > > Brian

    >
    > Guess you talk about dcm4che2 DICOM implementation. If so, you can
    > register the StopTagInputHandler as DicomInputHandler on
    > DicomInputStream before reading the DicomObject, to stop the reading
    > from the InputStream just before the Pixel Data value. Or you can
    > register your own implementation of DicomInputHandler, with
    >
    > public boolean readValue(DicomInputStream in) throws IOException {
    > if ((in.tag() & 0xffffffffL) != Tag.PixelData || in.level() > 0) {
    > return in.readValue(in);
    > }
    > // read out and process pixel data as you like
    > ....
    > return true;
    > }
    >
    > There is also a dcm4che2 user forum:
    >
    > http://forums.dcm4che.org/jiveforums...jspa?forumID=5
    >
    > which seems more appropriate to discuss usage of dcm4che2.
    >
    > gunter


    Thanks Gunter. That answers my question. I created an entry in the
    wiki describing this (http://www.dcm4che.org/confluence/display/d2/
    Using+DicomInputHandler).

+ Reply to Thread