IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
PixelFormatInfo Class Reference

Public Member Functions

 PixelFormatInfo (PixelFormat pixelFormat)
 Constructs a PixelFormatInfo object for the specified pixel format.
 
 PixelFormatInfo (string name)
 Constructs a PixelFormatInfo object from the name of a pixel format.
 
T MinimumValuePerChannel< T > ()
 Returns the minimum possible value per channel for the pixel format. Supports int (for integers) and float (for floating point) as type parameter.
 
int MinimumValuePerChannel ()
 Returns the minimum possible value per channel for the pixel format. This defaults to int for the type parameter.
 
T MaximumValuePerChannel< T > ()
 Returns the maximum possible value per channel for the pixel format. Supports int (for integers) and float (for floating point) as type parameter.
 
int MaximumValuePerChannel ()
 Returns the maximum possible value per channel for the pixel format. This defaults to int for the type parameter.
 
int GetChannelIndex (Channel channel)
 Returns the index of a specific channel within the pixel format.
 
bool HasChannel (Channel channel)
 Checks whether a specific channel is present in the pixel format.
 
ulong GetSizeInBytes (Size size)
 Calculates the memory size in bytes for a given image size.
 
override bool Equals (object? obj)
 Determines whether the specified object is equal to the current PixelFormatInfo.
 
override int GetHashCode ()
 Returns a hash code for the current pixel format.
 
override string ToString ()
 Returns a string representation of the pixel format info.
 

Properties

uint StorageBitsPerPixel [get]
 The total number of bits used per pixel for storage.
 
uint StorageBitsPerChannel [get]
 The number of bits used per channel for storage.
 
uint AllocatedBitsPerPixel [get]
 The number of allocated bits per pixel.
 
string Name [get]
 The human-readable name of the pixel format.
 
Channel[] Channels [get]
 The list of channels in the pixel format.
 
bool HasIntensityChannel [get]
 Checks whether the pixel format includes an intensity channel.
 
uint NumberOfChannels [get]
 The total number of channels in the pixel format.
 
bool IsSingleChannel [get]
 Whether the pixel format contains only a single channel.
 
PixelFormat PixelFormat [get]
 The underlying pixel format enumeration value.
 
bool IsPacked [get]
 Whether the pixel format is packed.
 
bool IsFloat [get]
 Whether the pixel format uses floating points.
 
bool IsInterleaved [get]
 Indicates whether the pixel format is interleaved.
 
PixelFormat UnpackedPixelFormat [get]
 Returns the unpacked pixel format for a packed pixel format. If the pixel format is already unpacked, the same format is returned.
 

Detailed Description

Provides information and utility functions for pixel formats. The PixelFormatInfo class offers methods to query characteristics of specific pixel formats, such as value ranges, storage sizes, and channel configurations.

Since
IDSImaging.Peak.Common 1.3

Definition at line 19 of file PixelFormatInfo.cs.

Constructor & Destructor Documentation

◆ PixelFormatInfo() [1/2]

PixelFormatInfo ( PixelFormat pixelFormat)
inline

Constructs a PixelFormatInfo object for the specified pixel format.

Parameters
pixelFormatThe pixel format to describe.

Definition at line 27 of file PixelFormatInfo.cs.

◆ PixelFormatInfo() [2/2]

PixelFormatInfo ( string name)
inline

Constructs a PixelFormatInfo object from the name of a pixel format.

Parameters
nameThe name of the pixel format.

Definition at line 36 of file PixelFormatInfo.cs.

Member Function Documentation

◆ Equals()

override bool Equals ( object? obj)
inline

Determines whether the specified object is equal to the current PixelFormatInfo.

Parameters
objThe object to compare with the current pixel format info.
Returns
true if the objects are equal; otherwise, false.

Definition at line 286 of file PixelFormatInfo.cs.

◆ GetChannelIndex()

int GetChannelIndex ( Channel channel)
inline

Returns the index of a specific channel within the pixel format.

Parameters
channelThe channel to locate.
Returns
The zero-based index of the channel. Or -1 if channel was not found.

Definition at line 256 of file PixelFormatInfo.cs.

◆ GetHashCode()

override int GetHashCode ( )
inline

Returns a hash code for the current pixel format.

Definition at line 319 of file PixelFormatInfo.cs.

◆ GetSizeInBytes()

ulong GetSizeInBytes ( Size size)
inline

Calculates the memory size in bytes for a given image size.

Parameters
sizeThe size of the image.
Returns
The total memory size in bytes.

Definition at line 276 of file PixelFormatInfo.cs.

◆ HasChannel()

bool HasChannel ( Channel channel)
inline

Checks whether a specific channel is present in the pixel format.

Parameters
channelThe channel to check for.
Returns
True if the channel exists in the pixel format, false otherwise.

Definition at line 266 of file PixelFormatInfo.cs.

◆ MaximumValuePerChannel()

int MaximumValuePerChannel ( )
inline

Returns the maximum possible value per channel for the pixel format. This defaults to int for the type parameter.

MaximumValuePerChannel<T>

Returns
The maximum value per channel.
Exceptions
CommonInvalidParameterException

Definition at line 246 of file PixelFormatInfo.cs.

◆ MaximumValuePerChannel< T >()

T MaximumValuePerChannel< T > ( )
inline

Returns the maximum possible value per channel for the pixel format. Supports int (for integers) and float (for floating point) as type parameter.

Template Parameters
TThe value type
Returns
The maximum value per channel.
Exceptions
CommonInvalidParameterException

Definition at line 222 of file PixelFormatInfo.cs.

◆ MinimumValuePerChannel()

int MinimumValuePerChannel ( )
inline

Returns the minimum possible value per channel for the pixel format. This defaults to int for the type parameter.

MinimumValuePerChannel<T>

Returns
The minimum value per channel.
Exceptions
CommonInvalidParameterException

Definition at line 210 of file PixelFormatInfo.cs.

◆ MinimumValuePerChannel< T >()

T MinimumValuePerChannel< T > ( )
inline

Returns the minimum possible value per channel for the pixel format. Supports int (for integers) and float (for floating point) as type parameter.

Template Parameters
TThe value type
Returns
The minimum value per channel.
Exceptions
CommonInvalidParameterException

Definition at line 186 of file PixelFormatInfo.cs.

◆ ToString()

override string ToString ( )
inline

Returns a string representation of the pixel format info.

Returns
A string that represents the current pixel format info.

Definition at line 328 of file PixelFormatInfo.cs.

Property Documentation

◆ AllocatedBitsPerPixel

uint AllocatedBitsPerPixel
get

The number of allocated bits per pixel.

Definition at line 72 of file PixelFormatInfo.cs.

◆ Channels

Channel [] Channels
get

The list of channels in the pixel format.

Definition at line 82 of file PixelFormatInfo.cs.

◆ HasIntensityChannel

bool HasIntensityChannel
get

Checks whether the pixel format includes an intensity channel.

Definition at line 87 of file PixelFormatInfo.cs.

◆ IsFloat

bool IsFloat
get

Whether the pixel format uses floating points.

Definition at line 112 of file PixelFormatInfo.cs.

◆ IsInterleaved

bool IsInterleaved
get

Indicates whether the pixel format is interleaved.

Interleaved pixel formats arrange multiple image streams in memory using different patterns. The exact interleaving strategy depends on the pixel format family.

Mono*_A_B

Images A and B alternate by row:

  • Memory row 1: Image A (row 1)
  • Memory row 2: Image B (row 1)
  • Memory row 3: Image A (row 2)
  • Memory row 4: Image B (row 2)
  • …

Bayer*_A_B

Images A and B are grouped in pairs of rows:

  • Memory row 1: Image A (row 1)
  • Memory row 2: Image A (row 2)
  • Memory row 3: Image B (row 1)
  • Memory row 4: Image B (row 2)
  • Memory row 5: Image A (row 3)
  • Memory row 6: Image A (row 4)
  • Memory row 7: Image B (row 3)
  • Memory row 8: Image B (row 4)
  • …

Mono*_AB_CD

Four image streams (A, B, C, D) are interleaved within each row:

  • Memory row 1: | A | B | A | B | A | B |
  • Memory row 2: | C | D | C | D | C | D |
  • Memory row 3: | A | B | A | B | A | B |
  • Memory row 4: | C | D | C | D | C | D |
  • …

Definition at line 171 of file PixelFormatInfo.cs.

◆ IsPacked

bool IsPacked
get

Whether the pixel format is packed.

Definition at line 107 of file PixelFormatInfo.cs.

◆ IsSingleChannel

bool IsSingleChannel
get

Whether the pixel format contains only a single channel.

Definition at line 97 of file PixelFormatInfo.cs.

◆ Name

string Name
get

The human-readable name of the pixel format.

Definition at line 77 of file PixelFormatInfo.cs.

◆ NumberOfChannels

uint NumberOfChannels
get

The total number of channels in the pixel format.

Definition at line 92 of file PixelFormatInfo.cs.

◆ PixelFormat

The underlying pixel format enumeration value.

Definition at line 102 of file PixelFormatInfo.cs.

◆ StorageBitsPerChannel

uint StorageBitsPerChannel
get

The number of bits used per channel for storage.

Definition at line 49 of file PixelFormatInfo.cs.

◆ StorageBitsPerPixel

uint StorageBitsPerPixel
get

The total number of bits used per pixel for storage.

Definition at line 44 of file PixelFormatInfo.cs.

◆ UnpackedPixelFormat

PixelFormat UnpackedPixelFormat
get

Returns the unpacked pixel format for a packed pixel format. If the pixel format is already unpacked, the same format is returned.

Definition at line 177 of file PixelFormatInfo.cs.