tag offset in file

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
okigan
Posts: 8
Joined: Mon, 2004-11-08, 22:31

tag offset in file

#1 Post by okigan » Mon, 2006-03-13, 19:25

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
Last edited by okigan on Wed, 2011-02-16, 15:55, edited 3 times in total.

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

#2 Post by Michael Onken » Tue, 2006-03-14, 11:03

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

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#3 Post by Jörg Riesmeier » Tue, 2006-03-14, 11:15

Igor, in order to help you it would be helpful if you could provide more details on the background of your question.

okigan
Posts: 8
Joined: Mon, 2004-11-08, 22:31

#4 Post by okigan » Wed, 2006-03-15, 02:05

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
Last edited by okigan on Wed, 2011-02-16, 15:55, edited 3 times in total.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#5 Post by Jörg Riesmeier » Wed, 2006-03-15, 17:56

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?

Post Reply

Who is online

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