Masood said:
Hi Max,
I am trying to read dicom file.
The preamble and the prefix of the file are by default in little
endian.
You are partially right. Make sure you've read PS3.10 2006, 7.1, esp. page 22.
You have to read the META information tags. When you match
the (0002,0010) tag, you'll find a UI Data Element. Extract the UID
using the current text encoding and store the announced syntax
to your reader after the group is finished. Group 0002 has a defined
Group Length ( "(0002,0000)") so you know when it is finished.
When you read beyond the meta group ( that many bytes that
are being announced) you "switch" your encoding.
After that the file is supposed to have tags followed by data.
ex: (0002) - value length - actual data
(0810) - value length - actual data
Are you sure you read PS3.5 2006? That is not a DICOM Data Element
Description (missing Tag Number and Value Representation (explicit
during meta data at least).
When we use the binaryreader , it reads the bytes in as is sequence
however when i use the Readint16 the order of the bytes is reversed.
ex: 02 00 would be read as 0002 when readint16 is used.
That is right.
You shouldn't use Binaryreader. Do your own, since you
need to switch. There is also a good library from John Skeet,
that already answered you.
best
doc