Class BitDepth
Extract image bit depth infomation from dataset and provide information for image rendering process
Inherited Members
Namespace: Dicom.Imaging
Assembly: cs.temp.dll.dll
Syntax
public class BitDepth
Constructors
BitDepth(Int32, Int32, Int32, Boolean)
Initialize the bit depth information using passed parameters
Declaration
public BitDepth(int allocated, int stored, int highBit, bool signed)
Parameters
Type | Name | Description |
---|---|---|
Int32 | allocated | Number of bits allocated per pixel sample (8,16,32) |
Int32 | stored | Number of bits stored per pixel sample (from LSB to MSB) |
Int32 | highBit | The high bit zero based index |
Boolean | signed | True if pixel data signed (sign will be stored in the high bit) |
Properties
BitsAllocated
Number of bits allocated per sample. Generally 1, 4, 8, or 16.
Declaration
public int BitsAllocated { get; }
Property Value
Type | Description |
---|---|
Int32 |
BitsStored
Number of bits stored per sample.
Declaration
public int BitsStored { get; }
Property Value
Type | Description |
---|---|
Int32 |
HighBit
Highest value bit in sample.
Declaration
public int HighBit { get; }
Property Value
Type | Description |
---|---|
Int32 |
IsSigned
Samples are signed values if true.
Declaration
public bool IsSigned { get; }
Property Value
Type | Description |
---|---|
Boolean |
MaximumValue
The maximum possible pixel value from stored bits
Declaration
public int MaximumValue { get; }
Property Value
Type | Description |
---|---|
Int32 |
MinimumValue
The minimum possible pixel value from stored bits
Declaration
public int MinimumValue { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
FromDataset(DicomDataset)
Create new instance of BitDepth from input dataset
Declaration
public static BitDepth FromDataset(DicomDataset dataset)
Parameters
Type | Name | Description |
---|---|---|
DicomDataset | dataset | Input dataset to extract bit depth information from |
Returns
Type | Description |
---|---|
BitDepth | New BitDepth instance |
GetHighBit(Int32, Boolean)
Return the high data bit index (excluding sign bit if data is signed)
Declaration
public static int GetHighBit(int bitsStored, bool isSigned)
Parameters
Type | Name | Description |
---|---|---|
Int32 | bitsStored | Number of bits |
Boolean | isSigned | True if signed |
Returns
Type | Description |
---|---|
Int32 | Index of high data bit (excluding sign bit if data is signed) |
GetMaximumValue(Int32, Boolean)
Calculate the maximum value for specified bits and sign
Declaration
public static int GetMaximumValue(int bitsStored, bool isSigned)
Parameters
Type | Name | Description |
---|---|---|
Int32 | bitsStored | Number of bits |
Boolean | isSigned | True if signed |
Returns
Type | Description |
---|---|
Int32 | The maximum value |
GetMinimumValue(Int32, Boolean)
Calculate the minimum value for specified bits and sign
Declaration
public static int GetMinimumValue(int bitsStored, bool isSigned)
Parameters
Type | Name | Description |
---|---|---|
Int32 | bitsStored | Number of bits |
Boolean | isSigned | True if signed |
Returns
Type | Description |
---|---|
Int32 | The minimum value |
GetNextPowerOf2(Int32)
Rounds up to the next power of 2.
Declaration
public static int GetNextPowerOf2(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value |
Returns
Type | Description |
---|---|
Int32 | Next power of 2 or current value if already power of 2. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |