# 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, UNKNOWN }

## Public Member Functions

| PixelFormat (ScalarType st)
| PixelFormat (unsigned short samplesperpixel=1, unsigned short bitsallocated=8, unsigned short bitsstored=8, unsigned short highbit=7, unsigned short pixelrepresentation=0)
| ~PixelFormat ()
unsigned short | GetBitsAllocated () const
| BitsAllocated.
unsigned short | GetBitsStored () const
| BitsStored.
unsigned short | GetHighBit () const
| HighBit.
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.
uint8_t | GetPixelSize () const
unsigned short | GetSamplesPerPixel () const
| Samples Per Pixel.
ScalarType | GetScalarType () const
| ScalarType does not take into account the sample per pixel.
const char * | GetScalarTypeAsString () const
| operator ScalarType () 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, and GetJPEGSamplePrecision.cxx.

## Member Enumeration Documentation

enum gdcm::PixelFormat::ScalarType

Enumerator:

  UINT8 |
  INT8 |
  UINT12 |
  INT12 |
  UINT16 |
  INT16 |
  UINT32 |
  INT32 |
  FLOAT16 |
  FLOAT32 |
  FLOAT64 |
  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.

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

BitsStored.

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

HighBit.

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.

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

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

Samples Per Pixel.

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

ScalarType does not take into account the sample per pixel.

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

gdcm::PixelFormat::operator ScalarType | ( |  | ) | 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.

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

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