GDCM 3.0.24
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
gdcm::PixelFormat Class Reference

PixelFormat. More...

#include <gdcmPixelFormat.h>

Public Types

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

Public Member Functions

 PixelFormat ()
 
 PixelFormat (ScalarType st)
 
 PixelFormat (unsigned short samplesperpixel, unsigned short bitsallocated=8, unsigned short bitsstored=8, unsigned short highbit=7, unsigned short pixelrepresentation=0)
 
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 IsCompatible (const TransferSyntax &ts) const
 
bool IsValid () const
 return IsValid
 
 operator ScalarType () const
 
bool operator!= (const PixelFormat &pf) const
 
bool operator!= (ScalarType st) const
 
bool operator== (const PixelFormat &pf) const
 
bool operator== (ScalarType st) 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.

By default the Pixel Type will be instantiated with the following parameters:

Fundamentally PixelFormat is very close to what DICOM allows. It will be very hard to extend this class for the upcoming DICOM standard where Floating 32 and 64bits will be allowed.

It is also very hard for this class to fully support 64bits integer type (see GetMin / GetMax signature restricted to 64bits signed).

Examples
CreateARGBImage.cxx, CreateCMYKImage.cxx, DecompressImage.cs, DecompressImageMultiframe.cs, DecompressJPEGFile.cs, ExtractImageRegion.cs, ExtractImageRegionWithLUT.cs, ExtractOneFrame.cs, FixJAIBugJPEGLS.cxx, GetArray.cs, GetJPEGSamplePrecision.cxx, MpegVideoInfo.cs, RescaleImage.cs, TemplateEmptyImage.cxx, csa2img.cxx, iU22tomultisc.cxx, and threadgdcm.cxx.

Member Enumeration Documentation

◆ ScalarType

Enumerator
UINT8 
INT8 
UINT12 
INT12 
UINT16 
INT16 
UINT32 
INT32 
UINT64 
INT64 
FLOAT16 
FLOAT32 
FLOAT64 
SINGLEBIT 
UNKNOWN 
Examples
GetArray.cs.

Constructor & Destructor Documentation

◆ PixelFormat() [1/3]

gdcm::PixelFormat::PixelFormat ( )
inline

◆ PixelFormat() [2/3]

gdcm::PixelFormat::PixelFormat ( unsigned short  samplesperpixel,
unsigned short  bitsallocated = 8,
unsigned short  bitsstored = 8,
unsigned short  highbit = 7,
unsigned short  pixelrepresentation = 0 
)
inlineexplicit

◆ PixelFormat() [3/3]

gdcm::PixelFormat::PixelFormat ( ScalarType  st)

Member Function Documentation

◆ GetBitsAllocated()

unsigned short gdcm::PixelFormat::GetBitsAllocated ( ) const
inline

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

Examples
GetJPEGSamplePrecision.cxx.

◆ GetBitsStored()

unsigned short gdcm::PixelFormat::GetBitsStored ( ) const
inline

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

Examples
GetJPEGSamplePrecision.cxx.

◆ GetHighBit()

unsigned short gdcm::PixelFormat::GetHighBit ( ) const
inline

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

◆ GetMax()

int64_t gdcm::PixelFormat::GetMax ( ) const

return the max possible of the pixel

◆ GetMin()

int64_t gdcm::PixelFormat::GetMin ( ) const

return the min possible of the pixel

◆ GetPixelRepresentation()

unsigned short gdcm::PixelFormat::GetPixelRepresentation ( ) const
inline

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

◆ GetPixelSize()

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
ExtractImageRegion.cs, ExtractImageRegionWithLUT.cs, ExtractOneFrame.cs, and threadgdcm.cxx.

◆ GetSamplesPerPixel()

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.

◆ GetScalarType()

ScalarType gdcm::PixelFormat::GetScalarType ( ) const

ScalarType does not take into account the sample per pixel.

Examples
GetArray.cs.

◆ GetScalarTypeAsString()

const char * gdcm::PixelFormat::GetScalarTypeAsString ( ) const
Examples
GetArray.cs.

◆ IsCompatible()

bool gdcm::PixelFormat::IsCompatible ( const TransferSyntax ts) const

◆ IsValid()

bool gdcm::PixelFormat::IsValid ( ) const

return IsValid

◆ operator ScalarType()

gdcm::PixelFormat::operator ScalarType ( ) const
inline

◆ operator!=() [1/2]

bool gdcm::PixelFormat::operator!= ( const PixelFormat pf) const
inline

◆ operator!=() [2/2]

bool gdcm::PixelFormat::operator!= ( ScalarType  st) const
inline

◆ operator==() [1/2]

bool gdcm::PixelFormat::operator== ( const PixelFormat pf) const
inline

◆ operator==() [2/2]

bool gdcm::PixelFormat::operator== ( ScalarType  st) const
inline

◆ Print()

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

Print.

◆ SetBitsAllocated()

void gdcm::PixelFormat::SetBitsAllocated ( unsigned short  ba)
inline

◆ SetBitsStored()

void gdcm::PixelFormat::SetBitsStored ( unsigned short  bs)
inline

◆ SetHighBit()

void gdcm::PixelFormat::SetHighBit ( unsigned short  hb)
inline

◆ SetPixelRepresentation()

void gdcm::PixelFormat::SetPixelRepresentation ( unsigned short  pr)
inline

◆ SetSamplesPerPixel()

void gdcm::PixelFormat::SetSamplesPerPixel ( unsigned short  spp)
inline

◆ SetScalarType()

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

Set PixelFormat based only on the ScalarType

Warning
: You need to call SetScalarType before SetSamplesPerPixel

◆ Validate()

bool gdcm::PixelFormat::Validate ( )
protected

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

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

Friends And Related Symbol Documentation

◆ Bitmap

friend class Bitmap
friend

◆ operator<<

std::ostream & operator<< ( std::ostream &  _os,
const PixelFormat pf 
)
friend

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