ImFusion SDK 4.3
HistogramDataComponent Class Reference

#include <ImFusion/Base/HistogramDataComponent.h>

DataComponent storing information on the intensity distribution of the image they are attached to. More...

+ Inheritance diagram for HistogramDataComponent:

Detailed Description

DataComponent storing information on the intensity distribution of the image they are attached to.

You can use it to query the minimum/maximum intensity of an image as well as its intensity histogram. Most information is lazy-evaluated and cached. Thus, you can expect consecutive calls to minmax() and/or histogram() as being free as long as the corresponding image remains unchanged.

Example:

SharedImageSet sis = ...;
// query minimum/maximum value of the first image in storage domain
vec2 minmaxStorage = HistogramDataComponent::get(sis).minmax(0);
// query 16-bin intensity histogram of the first image for the intensity range of [0..100]
auto histogram = HistogramDataComponent::get(sis).derivedHistogram(0, 16, vec2(0, 100));
const SharedImage * histogram(int index) const
Returns the intensity histogram for the image with the given index not considering any masks.
std::shared_ptr< const SharedImage > derivedHistogram(int index, int numBins, const vec2 &intensityRange) const
Returns the intensity histogram with the given parameters for image with the given index.
vec2 minmax() const
Returns the accumulated minimum and maximum intensity of all images considering all channels.
static HistogramDataComponent & get(const SharedImageSet &data)
Definition LazyInstantiatedDataComponent.h:71
Set of images independent of their storage location.
Definition SharedImageSet.h:42
Note
HistogramDataComponent does not support serialization since it will always be lazy-instantiated during runtime.
See also
Image, Pixel Value Domains

Public Member Functions

 HistogramDataComponent (const SharedImageSet *sis)
 Creates a new HistogramDataComponent for the given SharedImageSet.
 
const SharedImagehistogram (int index) const
 Returns the intensity histogram for the image with the given index not considering any masks.
 
std::unique_ptr< SharedImagehistogramMaskWeighted (int index) const
 Returns the intensity histogram for the image with the given index while considering masks.
 
std::shared_ptr< const SharedImagederivedHistogram (int index, int numBins, const vec2 &intensityRange) const
 Returns the intensity histogram with the given parameters for image with the given index.
 
vec2 minmax () const
 Returns the accumulated minimum and maximum intensity of all images considering all channels.
 
vec2 minmax (int index) const
 Returns the minimum and maximum intensity of the image with the given index considering all channels.
 
vec2 minmaxNormalized () const
 Returns the minimum and maximum intensity of all images in the normalized intensity range as it is seen by GLSL shaders.
 
vec2 minmaxNormalized (int index) const
 Returns the minimum and maximum intensity of the image in the normalized intensity range as it is seen by GLSL shaders.
 
vec2 minmaxOriginal () const
 Returns the minimum and maximum intensity of all images in the original pixel values domain.
 
vec2 minmaxOriginal (int index) const
 Returns the minimum and maximum intensity of the image in the original pixel values domain.
 
int maxNumBuckets (int index) const
 Returns the maximum number of buckets that makes sense for a histogram for the image with the given index.
 
vec2 computeAutoWindowing (double lowerLimit, double upperLimit, int index, bool considerMask=false) const
 Deduces optimal window/level (returned as vec2) settings the image with the given index based on its histogram.
 
vec2 computeAutoWindowingParameters (double window, double level, int index, bool considerMask=false) const
 Inverse computation of computeAutoWindowing.
 
- Public Member Functions inherited from TemporaryDataComponent
std::string id () const override
 Returns a unique string identifier for this type of data component.
 
std::unique_ptr< DataComponentBaseclone () const override
 Creates a clone of this data component.
 
bool assign (const DataComponentBase &) override
 Assigns the content of other to this data component.
 
bool equals (const DataComponentBase &) const override
 Compares this data component to other for equality.
 
void configure (const Properties *) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *) const override
 Serialize the current object configuration into the given Properties object.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
 
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
 

Additional Inherited Members

- Static Public Member Functions inherited from LazyInstantiatedDataComponent< HistogramDataComponent, SharedImageSet >
static HistogramDataComponentget (const SharedImageSet &data)
 Returns the specific options of type T that are associated with the given data.
 
static HistogramDataComponentget (const SharedImageSet *data)
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Member Functions inherited from DataComponentBase
 DataComponentBase (const DataComponentBase &)=default
 
DataComponentBaseoperator= (const DataComponentBase &other)=default
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Constructor & Destructor Documentation

◆ HistogramDataComponent()

HistogramDataComponent ( const SharedImageSet * sis)
explicit

Creates a new HistogramDataComponent for the given SharedImageSet.

Parameters
dataPointer to the SharedImageSet to compute histograms for.

Member Function Documentation

◆ histogram()

const SharedImage * histogram ( int index) const

Returns the intensity histogram for the image with the given index not considering any masks.

The binning of the histogram is based on the image content. The min/max bin correspond to the min/max value of the underlying image (i.e. minmax()). The number of bins determined by maxNumBuckets().

Note
This histogram will be cached by HistogramDataComponent.

◆ histogramMaskWeighted()

std::unique_ptr< SharedImage > histogramMaskWeighted ( int index) const

Returns the intensity histogram for the image with the given index while considering masks.

The binning of the histogram is based on the image content. The min/max bin correspond to the min/max value of the underlying image (i.e. minmax()). The number of bins determined by maxNumBuckets().

Note
Due to the volatility of the mask, the computed histogram can not be cached and will be recomputed every time it is requested.

◆ derivedHistogram()

std::shared_ptr< const SharedImage > derivedHistogram ( int index,
int numBins,
const vec2 & intensityRange ) const

Returns the intensity histogram with the given parameters for image with the given index.

The histogram is derived from the original full range histogram.

Parameters
indexIndex of the image to compute the histogram for.
numBinsNumber of bins of the histogram to compute.
intensityRangeIntensity range of the histogram to compute in storage value domain.
Note
This histogram will be cached (in an LRU cache) by HistogramDataComponent.

◆ minmax() [1/2]

vec2 minmax ( ) const

Returns the accumulated minimum and maximum intensity of all images considering all channels.

Note
The returned intensities are in storage value domain as they are stored in the MemImage.

◆ minmax() [2/2]

vec2 minmax ( int index) const

Returns the minimum and maximum intensity of the image with the given index considering all channels.

Note
The returned intensities are in storage value domain as they are stored in the MemImage.

◆ minmaxNormalized() [1/2]

vec2 minmaxNormalized ( ) const

Returns the minimum and maximum intensity of all images in the normalized intensity range as it is seen by GLSL shaders.

See also
GlUtils::storageToNormalized(), GlUtils::normalizedToStorage()

◆ minmaxNormalized() [2/2]

vec2 minmaxNormalized ( int index) const

Returns the minimum and maximum intensity of the image in the normalized intensity range as it is seen by GLSL shaders.

See also
GlUtils::storageToNormalized(), GlUtils::normalizedToStorage()

◆ minmaxOriginal() [1/2]

vec2 minmaxOriginal ( ) const

Returns the minimum and maximum intensity of all images in the original pixel values domain.

See also
Image::storageToOriginal()

◆ minmaxOriginal() [2/2]

vec2 minmaxOriginal ( int index) const

Returns the minimum and maximum intensity of the image in the original pixel values domain.

See also
Image::storageToOriginal()

◆ maxNumBuckets()

int maxNumBuckets ( int index) const

Returns the maximum number of buckets that makes sense for a histogram for the image with the given index.

For discrete numeric type images this matches the distance between the min and max value. However, it will never exceed the maximum supported 1D texture size, which is also the number of bins used for float images.

◆ computeAutoWindowing()

vec2 computeAutoWindowing ( double lowerLimit,
double upperLimit,
int index,
bool considerMask = false ) const

Deduces optimal window/level (returned as vec2) settings the image with the given index based on its histogram.

Parameters
lowerLimitPercentage of lower values removed by the auto windowing.
upperLimitPercentage of upper values removed by the auto windowing.
indexIndex of the image to compute the auto windowing for.
considerMaskFlag whether to consider a mask attached to the image when computing the auto windowing.

◆ computeAutoWindowingParameters()

vec2 computeAutoWindowingParameters ( double window,
double level,
int index,
bool considerMask = false ) const

Inverse computation of computeAutoWindowing.

Computes the needed lower/upper limit (returned as vec2) needed to deduce the auto windowing with the provided parameters.

Parameters
windowWindow parameter to use.
levelWindowing level to use.
indexIndex of the image to compute the inverse auto windowing for.
considerMaskFlag whether to consider a mask attached to the image when computing the inverse auto windowing.

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close