# gdcm::PixelFormat Class Reference

PixelFormat. More...

`#include <gdcmPixelFormat.h>`

List of all members.

## Public Types

enum | ScalarType { UINT8, INT8, UINT12, INT12, UINT16, INT16, UINT32, INT32, FLOAT16, FLOAT32, FLOAT64, SINGLEBIT, UNKNOWN }

## Public Member Functions

| PixelFormat (unsigned short samplesperpixel=1, unsigned short bitsallocated=8, unsigned short bitsstored=8, unsigned short highbit=7, unsigned short pixelrepresentation=0)
| PixelFormat (ScalarType st)
| ~PixelFormat ()
unsigned short | GetBitsAllocated () const
| BitsAllocated see Tag (0028,0100) US Bits Allocated.
unsigned short | GetBitsStored () const
| BitsStored see Tag (0028,0101) US Bits Stored.
unsigned short | GetHighBit () const
| HighBit see Tag (0028,0102) US High Bit.
int64_t | GetMax () const
| return the max possible of the pixel
int64_t | GetMin () const
| return the min possible of the pixel
unsigned short | GetPixelRepresentation () const
| PixelRepresentation: 0 or 1, see Tag (0028,0103) US Pixel Representation.
uint8_t | GetPixelSize () const
unsigned short | GetSamplesPerPixel () const
ScalarType | GetScalarType () const
| ScalarType does not take into account the sample per pixel.
const char * | GetScalarTypeAsString () const
bool | IsValid ()
| return IsValid
| operator ScalarType () const
bool | operator!= (ScalarType st) const
bool | operator!= (const PixelFormat &pf) const
bool | operator== (ScalarType st) const
bool | operator== (const PixelFormat &pf) const
void | Print (std::ostream &os) const
| Print.
void | SetBitsAllocated (unsigned short ba)
void | SetBitsStored (unsigned short bs)
void | SetHighBit (unsigned short hb)
void | SetPixelRepresentation (unsigned short pr)
void | SetSamplesPerPixel (unsigned short spp)
void | SetScalarType (ScalarType st)

## Protected Member Functions

bool | Validate ()
| When image with 24/24/23 was read, need to validate.

## Friends

class | Bitmap
std::ostream & | operator<< (std::ostream &_os, const PixelFormat &pf)

## Detailed Description

PixelFormat.

Note:
  By default the Pixel Type will be instanciated with the following parameters:
  - SamplesPerPixel : 1
  - BitsAllocated : 8
  - BitsStored : 8
  - HighBit : 7
  - PixelRepresentation : 0

Examples:

  CreateARGBImage.cxx, CreateCMYKImage.cxx, csa2img.cxx, GetJPEGSamplePrecision.cxx, and threadgdcm.cxx.

## Member Enumeration Documentation

enum gdcm::PixelFormat::ScalarType

Enumerator:

  UINT8 |
  INT8 |
  UINT12 |
  INT12 |
  UINT16 |
  INT16 |
  UINT32 |
  INT32 |
  FLOAT16 |
  FLOAT32 |
  FLOAT64 |
  SINGLEBIT |
  UNKNOWN |

## Constructor & Destructor Documentation

gdcm::PixelFormat::PixelFormat | ( | unsigned short | samplesperpixel = `1`,
|  | unsigned short | bitsallocated = `8`,
|  | unsigned short | bitsstored = `8`,
|  | unsigned short | highbit = `7`,
|  | unsigned short | pixelrepresentation = `0`
| ) |  | `[inline, explicit]`

gdcm::PixelFormat::PixelFormat | ( | ScalarType | st | ) |

gdcm::PixelFormat::~PixelFormat | ( |  | ) | `[inline]`

## Member Function Documentation

unsigned short gdcm::PixelFormat::GetBitsAllocated | ( |  | ) | const`[inline]`

BitsAllocated see Tag (0028,0100) US Bits Allocated.

unsigned short gdcm::PixelFormat::GetBitsStored | ( |  | ) | const`[inline]`

BitsStored see Tag (0028,0101) US Bits Stored.

unsigned short gdcm::PixelFormat::GetHighBit | ( |  | ) | const`[inline]`

HighBit see Tag (0028,0102) US High Bit.

int64_t gdcm::PixelFormat::GetMax | ( |  | ) | const

return the max possible of the pixel

int64_t gdcm::PixelFormat::GetMin | ( |  | ) | const

return the min possible of the pixel

unsigned short gdcm::PixelFormat::GetPixelRepresentation | ( |  | ) | const`[inline]`

PixelRepresentation: 0 or 1, see Tag (0028,0103) US Pixel Representation.

uint8_t gdcm::PixelFormat::GetPixelSize | ( |  | ) | const

return the size of the pixel This is the number of words it would take to store one pixel

Warning:
  the return value takes into account the SamplesPerPixel
  in the rare case when BitsAllocated == 12, the function assume word padding and value returned will be identical as if BitsAllocated == 16

Examples:
  threadgdcm.cxx.

unsigned short gdcm::PixelFormat::GetSamplesPerPixel | ( |  | ) | const

Samples Per Pixel see (0028,0002) US Samples Per Pixel DICOM - only allows 1, 3 and 4 as valid value. Other value are undefined behavior.

Examples:
  threadgdcm.cxx.

ScalarType gdcm::PixelFormat::GetScalarType | ( |  | ) | const

ScalarType does not take into account the sample per pixel.

const char* gdcm::PixelFormat::GetScalarTypeAsString | ( |  | ) | const

bool gdcm::PixelFormat::IsValid | ( |  | ) |

return IsValid

gdcm::PixelFormat::operator ScalarType | ( |  | ) | const`[inline]`

bool gdcm::PixelFormat::operator!= | ( | ScalarType | st | ) | const`[inline]`

bool gdcm::PixelFormat::operator!= | ( | const PixelFormat & | pf | ) | const`[inline]`

bool gdcm::PixelFormat::operator== | ( | const PixelFormat & | pf | ) | const`[inline]`

bool gdcm::PixelFormat::operator== | ( | ScalarType | st | ) | const`[inline]`

void gdcm::PixelFormat::Print | ( | std::ostream & | os | ) | const

Print.

Referenced by gdcm::operator<<().

void gdcm::PixelFormat::SetBitsAllocated | ( | unsigned short | ba | ) | `[inline]`

void gdcm::PixelFormat::SetBitsStored | ( | unsigned short | bs | ) | `[inline]`

void gdcm::PixelFormat::SetHighBit | ( | unsigned short | hb | ) | `[inline]`

void gdcm::PixelFormat::SetPixelRepresentation | ( | unsigned short | pr | ) | `[inline]`

void gdcm::PixelFormat::SetSamplesPerPixel | ( | unsigned short | spp | ) | `[inline]`

Examples:
  CreateARGBImage.cxx, and CreateCMYKImage.cxx.

References gdcmAssertMacro.

void gdcm::PixelFormat::SetScalarType | ( | ScalarType | st | ) |

Set PixelFormat based only on the ScalarType

Warning:
  : You need to call SetScalarType *before* SetSamplesPerPixel

bool gdcm::PixelFormat::Validate | ( |  | ) | `[protected]`

When image with 24/24/23 was read, need to validate.

Referenced by gdcm::Bitmap::SetPixelFormat().

## Friends And Related Function Documentation

friend class Bitmap `[friend]`

std::ostream& operator<< | ( | std::ostream & | _os,
|  | const PixelFormat & | pf
| ) |  | `[friend]`

The documentation for this class was generated from the following file:

- gdcmPixelFormat.h