Byte by Byte reading DICOM image

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jatinkdash
Posts: 3
Joined: Wed, 2010-05-19, 14:00

Byte by Byte reading DICOM image

#1 Post by jatinkdash »

How to read a DICOM image data byte by byte using DCMTK and write it to a raw file? As the header length in DICOM Image is variable, how to know the offset for the image date in a DICOM Image so as to read the image data byte by byte.

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

#2 Post by Jörg Riesmeier »

If you want to access certain data elements (like Pixel Data), you have to parse the whole file/dataset (at least up to the desired element).

Btw, what is the background of your question?
How to read a DICOM image data byte by byte using DCMTK and write it to a raw file?
If "DICOM image data" refers to pixel data, you could simply use dcmdump with option --write-pixel (+W).

jatinkdash
Posts: 3
Joined: Wed, 2010-05-19, 14:00

#3 Post by jatinkdash »

Yes DICOM Image data refers to pixeldata. dcmdump is an executable that does this offline but how to develop a piece of code to read the pixeldata and store it in a raw file?

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

#4 Post by Jörg Riesmeier »

In case of uncompressed pixel data, you could use findAndGetUint8/16Array() on the DICOM dataset in order to retrieve the value of the pixel data element. I guess there are numerous postings in this forum explaining how to get the pixel data in "raw format", i.e. as stored in the file/dataset.

jatinkdash
Posts: 3
Joined: Wed, 2010-05-19, 14:00

#5 Post by jatinkdash »

Thanks a lot.

Post Reply

Who is online

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