ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itk::RGBAPixel< TComponent > Class Template Reference

#include <itkRGBAPixel.h>

Detailed Description

template<typename TComponent = unsigned short>
class itk::RGBAPixel< TComponent >

Represent Red, Green, Blue and Alpha components for color images.

This class is templated over the representation used for each component.

The following syntax for assigning an index is allowed/suggested:

RGBAPixel<float> pixel; pixel = 1.0f, 0.0f, .5f, .8;
RGBAPixel<char> pixelArray[2];
pixelArray[0] = 255, 255, 255, 230;
pixelArray[1] = 255, 255, 244, 255;
RGBAPixel()=default

Since RGBAPixel is a subclass of Array, you can access its components as: pixel[0], pixel[1], pixel[2], pixel[3]

ITK Sphinx Examples:

Definition at line 58 of file itkRGBAPixel.h.

+ Inheritance diagram for itk::RGBAPixel< TComponent >:
+ Collaboration diagram for itk::RGBAPixel< TComponent >:

Public Types

using BaseArray = FixedArray<TComponent, 4>
 
using ComponentType = TComponent
 
using LuminanceType = typename NumericTraits<ComponentType>::RealType
 
using Self = RGBAPixel
 
using Superclass = FixedArray<TComponent, 4>
 
- Public Types inherited from itk::FixedArray< unsigned short, 4 >
using CArray
 
using const_iterator
 
using const_pointer
 
using const_reference
 
using const_reverse_iterator
 
using ConstIterator
 
using Iterator
 
using iterator
 
using pointer
 
using reference
 
using reverse_iterator
 
using SizeType
 
using value_type
 
using ValueType
 

Public Member Functions

const ComponentType & GetAlpha () const
 
const ComponentType & GetBlue () const
 
const ComponentType & GetGreen () const
 
LuminanceType GetLuminance () const
 
ComponentType GetNthComponent (int c) const
 
const ComponentType & GetRed () const
 
ComponentType GetScalarValue () const
 
bool operator< (const Self &r) const
 
RGBAPixel & operator= (const ComponentType r[4])
 
bool operator== (const Self &r) const
 
 RGBAPixel ()=default
 
 RGBAPixel (const ComponentType &r)
 
 RGBAPixel (std::nullptr_t)=delete
 
void Set (ComponentType red, ComponentType green, ComponentType blue, ComponentType alpha)
 
void SetAlpha (ComponentType alpha)
 
void SetBlue (ComponentType blue)
 
void SetGreen (ComponentType green)
 
void SetNthComponent (int c, const ComponentType &v)
 
void SetRed (ComponentType red)
 
template<typename TRGBAPixelValueType>
 RGBAPixel (const RGBAPixel< TRGBAPixelValueType > &r)
 
 RGBAPixel (const ComponentType r[4])
 
Self operator+ (const Self &r) const
 
Self operator- (const Self &r) const
 
Self operator* (const ComponentType &r) const
 
Self operator/ (const ComponentType &r) const
 
const Self & operator+= (const Self &r)
 
const Self & operator-= (const Self &r)
 
const Self & operator*= (const ComponentType &r)
 
const Self & operator/= (const ComponentType &r)
 
- Public Member Functions inherited from itk::FixedArray< unsigned short, 4 >
constexpr reference back ()
 
constexpr const_reference back () const
 
Iterator Begin ()
 
ConstIterator Begin () const
 
constexpr const_iterator begin () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
ValueType * data ()
 
const ValueType * data () const
 
constexpr bool empty () const noexcept
 
Iterator End ()
 
ConstIterator End () const
 
constexpr const_iterator end () const noexcept
 
constexpr iterator end () noexcept
 
void Fill (const ValueType &)
 
 FixedArray ()=default
 
 FixedArray (const FixedArray< TFixedArrayValueType, VLength > &r)
 
 FixedArray (const std::array< ValueType, VLength > &stdArray)
 
 FixedArray (const TScalarValue *r)
 
constexpr reference front ()
 
constexpr const_reference front () const
 
ValueType * GetDataPointer ()
 
const ValueType * GetDataPointer () const
 
 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (FixedArray)
 
FixedArray & operator= (const FixedArray< TFixedArrayValueType, VLength > &r)
 
FixedArray & operator= (const ValueType r[VLength])
 
bool operator== (const FixedArray &r) const
 
ReverseIterator rBegin ()
 
ConstReverseIterator rBegin () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
ReverseIterator rEnd ()
 
ConstReverseIterator rEnd () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
SizeType Size () const
 
constexpr SizeType size () const
 
void swap (FixedArray &other) noexcept
 
 FixedArray (const ValueType r[VLength])
 
 FixedArray (const ValueType &)
 
ITK_GCC_PRAGMA_PUSH ITK_GCC_SUPPRESS_Warray_bounds constexpr reference operator[] (unsigned int index)
 
constexpr const_reference operator[] (unsigned int index) const
 
ITK_GCC_PRAGMA_POP void SetElement (unsigned int index, const_reference value)
 
const_reference GetElement (unsigned int index) const
 

Static Public Member Functions

static unsigned int GetNumberOfComponents ()
 
- Static Public Member Functions inherited from itk::FixedArray< unsigned short, 4 >
static constexpr FixedArray Filled (const ValueType &value)
 

Static Public Attributes

static constexpr unsigned int Dimension = 4
 
static constexpr unsigned int Length = 4
 
- Static Public Attributes inherited from itk::FixedArray< unsigned short, 4 >
static constexpr unsigned int Dimension
 
static constexpr unsigned int Length
 

Member Typedef Documentation

◆ BaseArray

template<typename TComponent = unsigned short>
using itk::RGBAPixel< TComponent >::BaseArray = FixedArray<TComponent, 4>

Convenience type alias.

Definition at line 72 of file itkRGBAPixel.h.

◆ ComponentType

template<typename TComponent = unsigned short>
using itk::RGBAPixel< TComponent >::ComponentType = TComponent

Define the component type.

Definition at line 75 of file itkRGBAPixel.h.

◆ LuminanceType

template<typename TComponent = unsigned short>
using itk::RGBAPixel< TComponent >::LuminanceType = typename NumericTraits<ComponentType>::RealType

Definition at line 76 of file itkRGBAPixel.h.

◆ Self

template<typename TComponent = unsigned short>
using itk::RGBAPixel< TComponent >::Self = RGBAPixel

Standard class type aliases.

Definition at line 62 of file itkRGBAPixel.h.

◆ Superclass

template<typename TComponent = unsigned short>
using itk::RGBAPixel< TComponent >::Superclass = FixedArray<TComponent, 4>

Definition at line 63 of file itkRGBAPixel.h.

Constructor & Destructor Documentation

◆ RGBAPixel() [1/5]

template<typename TComponent = unsigned short>
itk::RGBAPixel< TComponent >::RGBAPixel ( )
default

Default-constructor.

Note
The other five "special member functions" are defaulted implicitly, following the C++ "Rule of Zero".

◆ RGBAPixel() [2/5]

template<typename TComponent = unsigned short>
template<typename TRGBAPixelValueType>
itk::RGBAPixel< TComponent >::RGBAPixel ( const RGBAPixel< TRGBAPixelValueType > & r)
inline

Pass-through constructor for the Array base class.

Definition at line 95 of file itkRGBAPixel.h.

◆ RGBAPixel() [3/5]

template<typename TComponent = unsigned short>
itk::RGBAPixel< TComponent >::RGBAPixel ( const ComponentType r[4])
inline

Pass-through constructor for the Array base class.

Definition at line 98 of file itkRGBAPixel.h.

◆ RGBAPixel() [4/5]

template<typename TComponent = unsigned short>
itk::RGBAPixel< TComponent >::RGBAPixel ( std::nullptr_t )
delete

Prevents copy-initialization from nullptr, as well as from 0 (NULL).

◆ RGBAPixel() [5/5]

template<typename TComponent = unsigned short>
itk::RGBAPixel< TComponent >::RGBAPixel ( const ComponentType & r)
inlineexplicit

Explicit constructor

Definition at line 108 of file itkRGBAPixel.h.

Member Function Documentation

◆ GetAlpha()

template<typename TComponent = unsigned short>
const ComponentType & itk::RGBAPixel< TComponent >::GetAlpha ( ) const
inlinenodiscard

Get the Alpha component.

Definition at line 240 of file itkRGBAPixel.h.

◆ GetBlue()

template<typename TComponent = unsigned short>
const ComponentType & itk::RGBAPixel< TComponent >::GetBlue ( ) const
inlinenodiscard

Get the Blue component.

Definition at line 233 of file itkRGBAPixel.h.

◆ GetGreen()

template<typename TComponent = unsigned short>
const ComponentType & itk::RGBAPixel< TComponent >::GetGreen ( ) const
inlinenodiscard

Get the Green component.

Definition at line 226 of file itkRGBAPixel.h.

◆ GetLuminance()

◆ GetNthComponent()

template<typename TComponent = unsigned short>
ComponentType itk::RGBAPixel< TComponent >::GetNthComponent ( int c) const
inlinenodiscard

Return the value for the Nth component.

Definition at line 157 of file itkRGBAPixel.h.

◆ GetNumberOfComponents()

template<typename TComponent = unsigned short>
static unsigned int itk::RGBAPixel< TComponent >::GetNumberOfComponents ( )
inlinestatic

Return the number of components.

Definition at line 150 of file itkRGBAPixel.h.

◆ GetRed()

template<typename TComponent = unsigned short>
const ComponentType & itk::RGBAPixel< TComponent >::GetRed ( ) const
inlinenodiscard

Get the Red component.

Definition at line 219 of file itkRGBAPixel.h.

◆ GetScalarValue()

template<typename TComponent = unsigned short>
ComponentType itk::RGBAPixel< TComponent >::GetScalarValue ( ) const
inlinenodiscard

Return the Euclidean norm of the vector defined by the RGB components. Alpha is not used.

Definition at line 164 of file itkRGBAPixel.h.

◆ operator*()

template<typename TComponent = unsigned short>
Self itk::RGBAPixel< TComponent >::operator* ( const ComponentType & r) const

Arithmetic operations between pixels. Return a new RGBAPixel.

◆ operator*=()

template<typename TComponent = unsigned short>
const Self & itk::RGBAPixel< TComponent >::operator*= ( const ComponentType & r)

Arithmetic-assignment operators.

◆ operator+()

template<typename TComponent = unsigned short>
Self itk::RGBAPixel< TComponent >::operator+ ( const Self & r) const

Arithmetic operations between pixels. Return a new RGBAPixel.

◆ operator+=()

template<typename TComponent = unsigned short>
const Self & itk::RGBAPixel< TComponent >::operator+= ( const Self & r)

Arithmetic-assignment operators.

◆ operator-()

template<typename TComponent = unsigned short>
Self itk::RGBAPixel< TComponent >::operator- ( const Self & r) const

Arithmetic operations between pixels. Return a new RGBAPixel.

◆ operator-=()

template<typename TComponent = unsigned short>
const Self & itk::RGBAPixel< TComponent >::operator-= ( const Self & r)

Arithmetic-assignment operators.

◆ operator/()

template<typename TComponent = unsigned short>
Self itk::RGBAPixel< TComponent >::operator/ ( const ComponentType & r) const

Arithmetic operations between pixels. Return a new RGBAPixel.

◆ operator/=()

template<typename TComponent = unsigned short>
const Self & itk::RGBAPixel< TComponent >::operator/= ( const ComponentType & r)

Arithmetic-assignment operators.

◆ operator<()

template<typename TComponent = unsigned short>
bool itk::RGBAPixel< TComponent >::operator< ( const Self & r) const

Implements strict weak ordering. For use in STL, e.g. std::map.

◆ operator=()

template<typename TComponent = unsigned short>
RGBAPixel & itk::RGBAPixel< TComponent >::operator= ( const ComponentType r[4])

Pass-through assignment operator for the Array base class.

◆ operator==()

template<typename TComponent = unsigned short>
bool itk::RGBAPixel< TComponent >::operator== ( const Self & r) const

◆ Set()

template<typename TComponent = unsigned short>
void itk::RGBAPixel< TComponent >::Set ( ComponentType red,
ComponentType green,
ComponentType blue,
ComponentType alpha )
inline

Set the four components.

Definition at line 209 of file itkRGBAPixel.h.

◆ SetAlpha()

template<typename TComponent = unsigned short>
void itk::RGBAPixel< TComponent >::SetAlpha ( ComponentType alpha)
inline

Set the Alpha component.

Definition at line 202 of file itkRGBAPixel.h.

◆ SetBlue()

template<typename TComponent = unsigned short>
void itk::RGBAPixel< TComponent >::SetBlue ( ComponentType blue)
inline

Set the Blue component.

Definition at line 195 of file itkRGBAPixel.h.

◆ SetGreen()

template<typename TComponent = unsigned short>
void itk::RGBAPixel< TComponent >::SetGreen ( ComponentType green)
inline

Set the Green component.

Definition at line 188 of file itkRGBAPixel.h.

◆ SetNthComponent()

template<typename TComponent = unsigned short>
void itk::RGBAPixel< TComponent >::SetNthComponent ( int c,
const ComponentType & v )
inline

Set the Nth component to v.

Definition at line 174 of file itkRGBAPixel.h.

◆ SetRed()

template<typename TComponent = unsigned short>
void itk::RGBAPixel< TComponent >::SetRed ( ComponentType red)
inline

Set the Red component.

Definition at line 181 of file itkRGBAPixel.h.

Member Data Documentation

◆ Dimension

template<typename TComponent = unsigned short>
unsigned int itk::RGBAPixel< TComponent >::Dimension = 4
staticconstexpr

Dimension of the vector space.

Definition at line 66 of file itkRGBAPixel.h.

◆ Length

template<typename TComponent = unsigned short>
unsigned int itk::RGBAPixel< TComponent >::Length = 4
staticconstexpr

Length of the pixel.

Definition at line 69 of file itkRGBAPixel.h.


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