230 likes | 304 Views
LUT Encoding. Dave Heaney A.L.I. Technologies, Inc. Image Module US Image Module Modality LUT Module VOI LUT Presentation LUT. Palette Color Table. As used for 8 and 16 bit Color Images A highlight of significant points and commonly raised issues. Requirements For Use. Image Pixel Module
E N D
LUT Encoding Dave Heaney A.L.I. Technologies, Inc.
Image ModuleUS Image ModuleModality LUT ModuleVOI LUTPresentation LUT
Palette Color Table As used for 8 and 16 bit Color Images A highlight of significant points and commonly raised issues
Requirements For Use • Image Pixel Module • Palette Color Lookup Table (For Ultrasound)
Palette Color Data Encoding • Depending on IOD, can be done using the Image Pixel Module or the Palette Color Lookup Table Module. • This presentation will discuss the Palette Color Lookup Table Module as it contains all the same Elements and thus both Modules are covered.
Each Table (Red, Green, Blue) has a Lookup Table Descriptor with 3 Values 1. Number of Entries in Lookup Table (Note that if the number of table entries is equal to 2^16 then this shall be 0. A common error is to not handle this case). 2. First Stored Pixel Value Mapped (Specifies which pixel value is mapped to the first entry in the Lookup Table. Do not assume for example that value 100 maps to the 100th or 101 entry, you must offset from this second entry) This value can be signed as it has the same VR as the Pixel Representation. 3. Specifies the number of bits for each entry in the Lookup Table Data (if the Palette Color Lookup Module is used, as for Ultrasound, then this must be 16). Note that the Lookup Table values must map across the full intensity range. There is no padding of the values so zero intensity must map to 0 and maximum intensity must map to 2^max bits - 1. A common error is to try and put 8 bit values into 16 bit table entries, padding the extra bits with 0. This is invalid and means that the decoder will not map across the full pixel intensity range.
Two Types of Tables • Contiguous Data Tables (only type in Image Pixel Module) • Segmented Data Tables as in the Palette Color Lookup Table Module
Contiguous Data Tables • Each Image pixel value (7FE0,0010) maps to a value in each of the Red, Green, and Blue Palette Tables using the second descriptor entry value for the offset. • The Palette Color Table Entries are intensity values as explained earlier. There is no padding so, to use the full possible range of intensities, values must be scaled across the full range of possible values. Must values use the data representation indicated by the Pixel Representation? Supplement 33 proposes that all LUT output must be unsigned. This requires a formal change to Part 3 for clarification. (i.e. for 2’s complement Pixel Representation and an 8 bit LUT is the minimum output value -128 or 0?).
Contiguous Palette Table Example 1 (0028,0002) Samples per Pixel: 1 (0028,0004) Photometric Interpretation: PALETTE COLOR (0028,0100) Bits Allocated: 16 (0028,0101) Bits Stored: 16 (0028,0103) Pixel Representation: 0000H unsigned (0028,1101) Red Palette Color Descriptor: 256 entries 0 first value mapped 16 bits per entry (0028,1102) Green Palette Color Descriptor: same as red (0028,1103) Blue Palette Color Descriptor: same as red (7FE0,0010) Pixel Data: (0028,1201) Red Palette: (0028,1202) Green Palette: (0028,1203) Blue Palette: 0000H|0000H|0001H|0000H|0005H|0002H 0000H|0101H|0202H|0303H|0404H|0505H 0000H|0101H|0202H|0303H|0404H|0505H 0000H|0101H|0202H|0303H|0404H|0505H
Contiguous Palette Table Example 2 Non-Ultrasound Palette Color Image: Complex Example (0028,0002) Samples per Pixel: 1 (0028,0004) Photometric Interpretation: PALETTE COLOR (0028,0100) Bits Allocated: 16 (0028,0101) Bits Stored: 16 (0028,0103) Pixel Representation: 0001H signed (0028,1101) Red Palette Color Descriptor: 256 entries -100 first value mapped 8 bits per entry (0028,1102) Green Palette Color Descriptor: same as red (0028,1103) Blue Palette Color Descriptor: same as red (7FE0,0010) Pixel Data: (0028,1201) Red Palette: (0028,1202) Green Palette: (0028,1203) Blue Palette: BUT ARE OUTPUT VALUES UNSIGNED OR 2’S COMPLEMENT? -103 | -100 | -100 | -99 | -98 | -96 | -97 | -96 FFFFH | FFFAH | FFF5H | FFF0H | FFEBH FFFFH | FFFFH | FFFFH | FFFFH | FFFFH FFFFH | FFFFH | FFFFH | FFFFH | FFFFH
Segmented Palette Color Tables • Data is stored in each Table as a series of segments • When the segments are expanded into the actual lookup table data, it shall have the number of table entries specified by the first value of the respective Descriptor, Number of Table Entries • Shall be used only when segmented lookup table data use is desirable and there is a single sample per pixel in the image When To Use? Segmented Palette Color Tables are useful if the Palette Color Data includes repeated blocks of values and/or blocks of values which are related linearly. By repeatedly referencing a single block of values rather than repeating the entire block and/or representing linearly related values by their mathematical relationship significant resource savings can be made. Segmented Palette Color Tables are a means of implementing non-lossy compression for Palette Color Data but is only possible with very specific data sets. Note that they may not be widely supported by viewing systems.
Segmented Palette Color Tables Compresses Palette Color Lookup Table Data: Currently there are 3 types of segments: discrete, linear, and indirect. The segments type is identified by opcodes. Segment Types: Opcode Segment Type 0 Discrete 1 Linear 2 Indirect 3 & Above Reserved Segment 0 | Segment 1 | Segment 2 | Segment 3 | … | Segment N
Discrete Segment Type Used to represent a series of palette components which are not monotonic with respect to their predecessors or successors. i.e. Use this type of segment for data which is non-linear with respect to preceding or following values. These values cannot be compressed but can be repeated so if there are repeating non-linear blocks then make them into separate Discrete Segments. Discrete Segment Type Data Format
Linear Segment Type The linear segment represents a series of palette components whose values may be represented by a straight line. X = palette address, Y = Value contained in the palette. (X0, Y0) = end of the previous segment (X0 + SegmentLength, Y1) = end of this linear segment Where Y1 is contained in the data portion of this segment. During expansion the application should “connect” the previous segment’s endpoint (X0, Y0) with this segment’s endpoint, (X0 + SegmentLength, Y1) using a straight line, by computing the values for each point between the endpoints. Note: Because the linear segment uses the end point from the previous segment, a linear segment can not be the first segment. Linear Segment Type Data Format
Indirect Segment Type The indirect segment allows the re-use of repetitive regions within the lookup table without respecifying the segment. The opcode is followed by the number of segments to copy and one offset pointer to the first segment to copy. The byte offset is relative to the beginning of the lookup table. For example, if an indirect segment wants to point to the first segment, then the offset will be zero. The offset is a 32 bit value but is stored in the segment as a least significant 16 bit value followed by a most significant 16 bit value. An indirect segment shall not point to or copy another indirect segment, to avoid recursion and infinite loops. Indirect Segment Type Data Format
Modality LUT • The Modality LUT allows the manipulation of the image data in two different manners. In both cases it is implied that the manipulation can only occur for grayscale data. • 1. The data can be manipulated by the application of a single LUT. The LUT is similar to one used for Palette Color Data. The LUT has a descriptor (0028,3002) with the same elements as for a color LUT: • Number of Entries in Lookup Table. • First Stored Pixel Value Mapped (Note: Has same VR as Pixel Representation). • Specifies the number of bits for each entry in the Lookup Table Data (8 or 16). The LUT data itself (0028,3006) has output values defined by the Modality LUT Type (0028,3004). Currently the only defined type is OD, the number in the LUT represents thousands of optical density.
Modality LUT (Cont.) Optical density is always positive so a question arises as to whether this defined type indicates that the LUT values are unsigned regardless of the Pixel Representation?* * The issue of output type is an important one when one or more LUTs are applied to the original image data. It would be optimal if each LUT descriptor indicated the representation of the expected output values. Currently the Standard is ambiguous in regards to this issue. A proposal is to treat all output values as unsigned. Another possibility is to always conform to the Pixel Representation unless the conversion is clear based on the output Type (i.e. Hounsfeld Units are signed, Optical Density is unsigned). For now, I suggest to those encoding the data that they choose options to encode data unambiguously if possible. For example, 16 bit values may have to be used instead of just 8 bits because of this interpretation issue (the encoder wants output values which use the full 8 bit unsigned output range, 0 to 255, but Pixel Representation is 2’s complement. Thus 16 bits are allocated to unambiguously define the unsigned values 0 to 255.).
Modality LUT (Cont.) A second type of data manipulation can be specified in the Modality LUT Module 2. The data can be manipulated by applying a linear LUT represented by two values, Slope and Intercept. Output Units = Slope * Image Value + Intercept These values can be signed or unsigned regardless of the specified Pixel Representation. Because the Rescale Types are not defined or enumerated care must be taken to ensure proper interpretation of the modified values and one must ensure that underflow or overflow does not occur due to a change in data representation. For CT image data Slope and Intercept are used to convert to Hounsfeld Units which are signed values.
Another LUT module is the VOI LUT Module. This Module also allows the specification of how the data should be manipulated in 2 different manners. This manipulation must always occur after the application of the Modality LUT if one exists. 1. The data can be manipulated using a single LUT similar to the Modality LUT. This type of LUT contains a description element as specified for the other types of LUT. In addition, there is a LUT explanation but there are no defined or enumerated values. Again, the issue of output value type is raised. As the purpose of this LUT is to usually map a certain range of data to the viewable intensities I currently treat all output values as unsigned. This may cause compatibility issues however. VOI LUT
2. The data can be manipulated by applying a linear LUT represented by two values, Window Center and Window Width. Window Center (0028,1050) and Window Width (0028,1051) specify a linear conversion of data values by specifying a visible ‘Window’ of values which are to be mapped to the range of intensities. All those values less than the minimum value in the Window are to be mapped to minimum intensity while all those greater than the maximum value in the Window are to be mapped to maximum intensity. The values in between are mapped linearly to the full available range of intensities. Window Center contains the pixel value that is the center of the Window and Window Width contains the width of the window. If multiple pairs are specified then they should be applied independently. VOI LUT
Presentation LUT • The objective of the Presentation LUT is to realize tailored image display. It is used to prepare image pixel data for devices that conform to the Grayscale Standard Display Function defined in PS 3.14. The output of the Presentation LUT is Presentation Values (P-Values) which are approximately related to human perceptual responses. They are intended to facilitate common input for hardcopy and softcopy devices. This is the final LUT to be applied to the pixel data. The modality LUT being applied first if present, followed by the VOI LUT and finally the Presentation LUT. • The data can be manipulated using a single LUT similar to the Modality LUT or a single Palette Color LUT. This type of LUT contains a description element containing the 3 values as specified for the other types of LUT. The values encoded in the LUT are always P-Values and thus the output data representation is always unsigned, regardless of Pixel Representation. • A further element of this Module is the Presentation LUT Shape which indicates the type of input to the Presentation LUT: • IDENTITY = input is in P-Values, no further translation is required. • LIN OD = input is in linear optical density over the range of Min Density (2010, 0120) and Max Density (2010,1030) - as from Modality LUT.