Given a DICOM file what would a fast way to find out the location of a specific tag in it
(i.e. the offset of the tag from the begining of the file)?
Thanks,
Igor
tag offset in file
Moderator: Moderator Team
tag offset in file
Last edited by okigan on Wed, 2011-02-16, 15:55, edited 3 times in total.
-
- DCMTK Developer
- Posts: 2051
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Hi Igor,
this is not an easy task and there is no standard way to accomplish this, because it's impossible to predict the lenght of each attribute value in the DICOM file and there are other encoding options (undefined/defined length for Sequences and items), that complicates this task.
Using group-, item-, sequence- and attribute lengths if available, you could skip some bytes while reading the file.
Regards,
Michael
this is not an easy task and there is no standard way to accomplish this, because it's impossible to predict the lenght of each attribute value in the DICOM file and there are other encoding options (undefined/defined length for Sequences and items), that complicates this task.
Using group-, item-, sequence- and attribute lengths if available, you could skip some bytes while reading the file.
Regards,
Michael
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
J?rg,
This is specifically about pixel data (and only a subset of data types) but if I could know the offset of the pixel data from the beginning of the file I would work with many files in much more memory efficient manner (I would take care of intercept & offset).
I could write the parser myself (ie. given vr skip -- skip x bytes) but i wanted to check before possibly reinventing the wheel.
Thanks,
Igor
This is specifically about pixel data (and only a subset of data types) but if I could know the offset of the pixel data from the beginning of the file I would work with many files in much more memory efficient manner (I would take care of intercept & offset).
I could write the parser myself (ie. given vr skip -- skip x bytes) but i wanted to check before possibly reinventing the wheel.
Thanks,
Igor
Last edited by okigan on Wed, 2011-02-16, 15:55, edited 3 times in total.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
In order to determine the byte offset of a particular data element you need to parse the file up to the position where the element is stored. There is no reliable way to avoid parsing the tag-based structure. Any heuristical approach will certainly fail on some DICOM files.
Btw, is your question related to the DCMTK, i.e. are you trying to enhance the performance of the dcmdata loadFile/read methods?
Btw, is your question related to the DCMTK, i.e. are you trying to enhance the performance of the dcmdata loadFile/read methods?
Who is online
Users browsing this forum: No registered users and 1 guest