Is the position of data in a DICOM file always the same? - DICOM

This is a discussion on Is the position of data in a DICOM file always the same? - DICOM ; Hi, If I was to read a DICOM file as a binary file in C++, matching on tags, would I get the data from the same positions in the files every time? In other words, can I read i.e the ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Is the position of data in a DICOM file always the same?

  1. Is the position of data in a DICOM file always the same?

    Hi,

    If I was to read a DICOM file as a binary file in C++, matching on
    tags, would I get the data from the same positions in the files every
    time? In other words, can I read i.e the pixelspacing directly by
    specifying the position in the file or do I read 2 bytes at the time
    matching on tags?

    Best regards
    Pål Eilertsen

  2. Re: Is the position of data in a DICOM file always the same?

    > If I was to read a DICOM file as a binary file in C++, matching on
    > tags, would I get the data from the same positions in the files every
    > time?


    No.

    > In other words, can I read i.e the pixelspacing directly by
    > specifying the position in the file or do I read 2 bytes at the time
    > matching on tags?


    No again.

    You need a complete parser that understands the hierarchical structure
    of a DICOM object and that also supports the various encoding options
    (big endian, little endian, implicit VR, explicit VR, defined length,
    undefined length etc. etc.). Various toolkits are available that
    implement this. Don't reeinvent the wheel unless you have lots of
    surplus time - this is not a trivial task.

    Regards,
    Marco Eichelberg
    OFFIS

  3. Re: Is the position of data in a DICOM file always the same?

    Marco Eichelberg wrote:
    >> If I was to read a DICOM file as a binary file in C++, matching on
    >> tags, would I get the data from the same positions in the files every
    >> time?

    >
    >
    > No.
    >
    >> In other words, can I read i.e the pixelspacing directly by
    >> specifying the position in the file or do I read 2 bytes at the time
    >> matching on tags?

    >
    >
    > No again.
    >
    > You need a complete parser that understands the hierarchical structure
    > of a DICOM object and that also supports the various encoding options
    > (big endian, little endian, implicit VR, explicit VR, defined length,
    > undefined length etc. etc.). Various toolkits are available that
    > implement this. Don't reeinvent the wheel unless you have lots of
    > surplus time - this is not a trivial task.


    gdcm 1.0 was released:

    http://www.creatis.insa-lyon.fr/Public/Gdcm/

    It's open source and under a BSD license.

    HTH
    Mathieu

+ Reply to Thread