Class CDisplaySettingsHelper#

Class Documentation#

class CDisplaySettingsHelper#

This is a utility in order to prepare the information required for the multi-channel-composition functions from the display-settings (e.g. retrieved from metadata). If the gradation curve is given as gamma or as a spline, we calculate here the lookup-table. In addition, we make sure that only channels which are “enabled” (in the display-settings) are considered.

Public Functions

inline void Initialize(const libCZI::IDisplaySettings *ptrDspSetting, const std::function<libCZI::PixelType(int chIndex)> &getPixelTypeForChannelIndex)#

Initializes this object with a display-settings object.

After this object is initialized, it will provide the Compositors::ChannelInfo information for all ‘enabled’ channels in the specified display-settings object.

Parameters:
  • ptrDspSetting – A pointer to a display-settings object.

  • getPixelTypeForChannelIndex – A functor which is called in order to retrieve the pixeltype of the bitmap passed in for the channel with the specified channel index.

inline void Initialize(const std::function<bool(int&, std::shared_ptr<libCZI::IChannelDisplaySetting>&)> &getChDisplaySettingAndChannelIdx, const std::function<libCZI::PixelType(int chIndex)> &getPixelTypeForChannelIndex)#

Initializes this object by specified a set of ChannelDisplaySetting-objects (and their respective channel-index).

After this object is initialized, it will provide the Compositors::ChannelInfo information for all ‘enabled’ channels.

Parameters:
  • getChDisplaySettingAndChannelIdx – A functor which is used to retrieve a ChannelDisplaySetting-objects and its respective channels-index. If the functor returns false, the enumeration is cancelled (and the functor is not called anymore).

  • getPixelTypeForChannelIndex – A functor which is called in order to retrieve the pixeltype of the bitmap passed in for the channel with the specified channel index.

inline const std::vector<int> &GetActiveChannels() const#

Gets a vector containing the channel-indices of the active channels.

Returns:

The vector with the channel-indices of the active channels.

inline int GetActiveChannelsCount() const#

Gets count of active channels.

Returns:

The active channels count.

inline const libCZI::Compositors::ChannelInfo &GetActiveChannel(int idx) const#

Gets a reference to the channel-info for the channel with the specified index. The index must be in less than the number returned from GetActiveChannelsCount(), otherwise the behavior is undefined. Note that the index specified here is NOT the channel-index, it is just the index into the list of active channels (held in this class).

Parameters:

idx – The index.

Returns:

The channel-info for the (active) channel with the specified index.

inline const libCZI::Compositors::ChannelInfo *GetChannelInfosArray() const#

Gets a pointer to the channel-infos array. Note that the data structure contains pointers to memory (ptrLookUpTable notably) which refer to memory owned by this class. So it is safe to use this data structure as long as this object exists, if this object has been destroyed, the behavior is undefined. Also the behavior is undefined if this class has not been successfully initialized.

Returns:

A pointer to the channel-infos array (containing as many elements as determined by GetActiveChannelsCount).

Public Static Functions

static inline void EnumEnabledChannels(const libCZI::IDisplaySettings *ptrDspSetting, const std::function<bool(int)> &funcEnabledChannel)#

Enumerate the enabled channels. The functor will be called for each active channel (with the channel-index passed in).

Parameters:
  • ptrDspSetting – The display settings.

  • funcEnabledChannel – A functor which will be called for each active channel.

static inline std::vector<int> GetActiveChannels(const libCZI::IDisplaySettings *ptrDspSetting)#

Gets a vector containing the channel indices of the active channels.

Parameters:

ptrDspSetting – The display settings.

Returns:

A vector containing the channel indices of the active channels.