0
votes

I'm trying to determine the proper way to spread competence between DICOM processing modules. One of the steps is to "take the dataset out of the envelope" by which I mean to decode attributes based on the transfer syntax. Two things i cannot understand:

  1. DICOM Table 6.2-1. DICOM Value Representations gives a requirements, that the value codes must meet in order to be concideret valid (ex. no control characters in AE). However, some of the VRs depend on the Character Set defined by (0008,0005) - also a member of the "envelope". Isn't it a contradiction?
  2. "Data Element (7FE0,0010) Pixel Datawhere Bits Allocated (0028,0100) has a value less than or equal to 8 shall have the Value Representation OB or OW and shall be encoded in Little Endian." This sentence occurs a several times in the standard. How can I determine whether to swap bytes? (not looking at BitsAllocated - a member of the envelope)

Am I missing something, or is it really necessary to interpret some Data Elements from Data Set in order to validate other in the DICOM File, and Data Structure?

EDIT: Let me refrase my problem:

Most of the times, transfer syntax is sufficient to decode(decompress) Pixel Data and flatten endiannes to the prefered format. Thats before any high bit/bits alloc/bits stored transformations and following modality -> voi).

But in the case of Pixel Data stored in VR=OW - we don't know whether to swap bytes or not, because we dont know if the image has bits allocated 8 or more (its also being decoded right now (endian swapped, vr validated)).

The story with strings is similar.

EDIT: The answer to OW problem was here: Is the "Other Word" VR legal for an 8-bit RGB image?

My last problem is: How to chcek wether VR=LO element does not contain any control characters, without knowing what the (0008,0005) Character Set is? (as it might not be encoded yet too)

1
Is your question limited to just decoding the PixelData, or does it cover DICOM validation of the entire file?Chris O
In fact it's limited to Pixel Data in transfer syntax Big Endian, 8bit, stored in VR=OW. And also to the situation when I want to validate the string VRs, that are supposed to be displayed in i.e. Chinese Character Set.Witek
@WitoldKsiążek Strings are stored with other data types, never with OW (e.g.: PN for patient name, UT for unlimited text, etc)Paolo Brandoli
See this answer stackoverflow.com/questions/8820965/…. Part 5 annex D of the standard has some nice example that uses OW for imagesPaolo Brandoli
That solves my OW problem! Thank you very much. Problem with text encoded with specyfic character set stays... I'll update the question soon.Witek

1 Answers

2
votes

If the transfer syntax specifies a Jpeg image then you don't need much more because most of the information is in the jpeg stream.

For all the transfer syntaxes you need to know:

  • the photometric interpretation (but pay attention to some WRONG dataset that specify a RGB photometric instead of YBR). MONOCHROME or MONOCHROME2 specify if the minimum pixel value represents white or black

Additionally, for DICOM transfer syntax and lossless JPEG you also need to know:

  • bits allocated
  • high bit
  • the integer type (signed/unsigned)

For DICOM transfer syntax you also need to know:

  • big endian or little endian to reverse the bytes when the data type is OW