#include <itkLabelStatisticsImageFilter.h>
Given an intensity image and a label map, compute min, max, variance and mean of the pixels associated with each label or segment.
LabelStatisticsImageFilter computes the minimum, maximum, sum, mean, median, variance and sigma of regions of an intensity image, where the regions are defined via a label map (a second input). The label image should be integral type. The filter needs all of its input image. It behaves as a filter with an input and output. Thus it can be inserted in a pipeline with other filters and the statistics will only be recomputed if a downstream filter changes.
Optionally, the filter also computes intensity histograms on each object. If histograms are enabled, a median intensity value can also be computed, although its accuracy is limited to the bin width of the histogram. If histograms are not enabled, the median returns zero.
This filter is automatically multi-threaded and can stream its input when NumberOfStreamDivisions is set to more than
Definition at line 63 of file itkLabelStatisticsImageFilter.h.
Classes | |
class | LabelStatistics |
Static Public Member Functions | |
static Pointer | New () |
![]() | |
static double | GetGlobalDefaultCoordinateTolerance () |
static double | GetGlobalDefaultDirectionTolerance () |
static void | SetGlobalDefaultCoordinateTolerance (double) |
static void | SetGlobalDefaultDirectionTolerance (double) |
![]() | |
static bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOff () |
static void | GlobalWarningDisplayOn () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool val) |
![]() | |
static void | BreakOnError () |
static Pointer | New () |
Static Public Attributes | |
static constexpr unsigned int | ImageDimension = TInputImage::ImageDimension |
![]() | |
static constexpr unsigned int | InputImageDimension = InputImageType::ImageDimension |
Private Member Functions | |
void | MergeMap (MapType &, MapType &) const |
Private Attributes | |
MapType | m_LabelStatistics {} |
RealType | m_LowerBound {} |
std::mutex | m_Mutex {} |
HistogramType::SizeType | m_NumBins {} |
RealType | m_UpperBound {} |
bool | m_UseHistograms {} |
ValidLabelValuesContainerType | m_ValidLabelValues {} |
Additional Inherited Members | |
![]() | |
template<typename TSourceObject> | |
static void | MakeRequiredOutputs (TSourceObject &sourceObject, const DataObjectPointerArraySizeType numberOfRequiredOutputs) |
static constexpr float | progressFixedToFloat (uint32_t fixed) |
static uint32_t | progressFloatToFixed (float f) |
![]() | |
TimeStamp | m_OutputInformationMTime {} |
bool | m_Updating {} |
![]() | |
std::atomic< int > | m_ReferenceCount {} |
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::BoundingBoxType = std::vector<IndexValueType> |
Bounding Box-related type alias
Definition at line 108 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::ConstPointer = SmartPointer<const Self> |
Definition at line 72 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::DataObjectPointer = typename DataObject::Pointer |
Smart Pointer type to a DataObject.
Definition at line 102 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::HistogramPointer = typename HistogramType::Pointer |
Definition at line 112 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::HistogramType = itk::Statistics::Histogram<RealType> |
Histogram-related type alias
Definition at line 111 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::IndexType = typename TInputImage::IndexType |
Definition at line 84 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::InputImagePointer = typename TInputImage::Pointer |
Image related type alias.
Definition at line 81 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelImagePointer = typename TLabelImage::Pointer |
Definition at line 89 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelImageType = TLabelImage |
Label image related type alias.
Definition at line 88 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelIndexType = typename TLabelImage::IndexType |
Definition at line 92 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelPixelType = typename TLabelImage::PixelType |
Definition at line 93 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelRegionType = typename TLabelImage::RegionType |
Definition at line 90 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelSizeType = typename TLabelImage::SizeType |
Definition at line 91 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::MapConstIterator = typename MapType::const_iterator |
Definition at line 273 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::MapIterator = typename MapType::iterator |
Definition at line 272 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::MapSizeType = IdentifierType |
Definition at line 274 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::MapType = std::unordered_map<LabelPixelType, LabelStatistics> |
Type of the map used to store data per label
Definition at line 271 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::PixelType = typename TInputImage::PixelType |
Definition at line 85 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::Pointer = SmartPointer<Self> |
Definition at line 71 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::RealObjectType = SimpleDataObjectDecorator<RealType> |
Type of DataObjects used for scalar outputs
Definition at line 105 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType = typename NumericTraits<PixelType>::RealType |
Type to use for computations.
Definition at line 99 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::RegionType = typename TInputImage::RegionType |
Definition at line 82 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::Self = LabelStatisticsImageFilter |
Standard Self type alias
Definition at line 69 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::SizeType = typename TInputImage::SizeType |
Definition at line 83 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::Superclass = ImageSink<TInputImage> |
Definition at line 70 of file itkLabelStatisticsImageFilter.h.
using itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::ValidLabelValuesContainerType = std::vector<LabelPixelType> |
Type of the container used to store valid label values
Definition at line 277 of file itkLabelStatisticsImageFilter.h.
|
protected |
Referenced by GetNameOfClass().
|
overrideprotecteddefault |
|
overrideprotectedvirtual |
Do final mean and variance computation from data accumulated in threads.
Reimplemented from itk::StreamingProcessObject.
|
inlineoverrideprotectedvirtual |
Called before the input's first requested region is set or updated.
Reimplemented from itk::ImageSink< TInputImage >.
Definition at line 390 of file itkLabelStatisticsImageFilter.h.
References itk::ImageSink< TInputImage >::AllocateOutputs(), and m_LabelStatistics.
|
virtual |
Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.
Reimplemented from itk::LightObject.
BoundingBoxType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetBoundingBox | ( | LabelPixelType | label | ) | const |
Return the computed bounding box for a label. A vector of minIndex, maxIndex pairs for each axis. The intervals include the endpoints.
MapSizeType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetCount | ( | LabelPixelType | label | ) | const |
Return the number of pixels for a label.
HistogramPointer itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetHistogram | ( | LabelPixelType | label | ) | const |
Return the histogram for a label
RealType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetMaximum | ( | LabelPixelType | label | ) | const |
Return the computed Maximum for a label.
RealType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetMean | ( | LabelPixelType | label | ) | const |
Return the computed Mean for a label.
RealType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetMedian | ( | LabelPixelType | label | ) | const |
Return the computed Median for a label. Requires histograms to be enabled!
RealType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetMinimum | ( | LabelPixelType | label | ) | const |
Return the computed Minimum for a label.
|
overridevirtual |
Reimplemented from itk::ImageSink< TInputImage >.
References LabelStatisticsImageFilter().
|
inline |
Definition at line 312 of file itkLabelStatisticsImageFilter.h.
References GetNumberOfObjects().
|
inline |
Get the number of labels used
Definition at line 306 of file itkLabelStatisticsImageFilter.h.
References m_LabelStatistics.
Referenced by GetNumberOfLabels().
|
inlineoverridevirtual |
Get the number of pieces to divide the input. The upstream pipeline will be executed this many times.
Reimplemented from itk::ImageSink< TInputImage >.
Definition at line 376 of file itkLabelStatisticsImageFilter.h.
References itk::ImageSink< TInputImage >::GetNumberOfStreamDivisions().
RegionType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetRegion | ( | LabelPixelType | label | ) | const |
Return the computed region.
RealType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetSigma | ( | LabelPixelType | label | ) | const |
Return the computed Standard Deviation for a label.
RealType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetSum | ( | LabelPixelType | label | ) | const |
Return the compute Sum for a label.
|
virtual |
|
inlinevirtual |
Definition at line 286 of file itkLabelStatisticsImageFilter.h.
References m_ValidLabelValues.
RealType itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::GetVariance | ( | LabelPixelType | label | ) | const |
Return the computed Variance for a label.
|
inline |
Does the specified label exist? Can only be called after a call a call to Update().
Definition at line 299 of file itkLabelStatisticsImageFilter.h.
References m_LabelStatistics.
itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::itkGetInputMacro | ( | LabelInput | , |
TLabelImage | ) |
Set the label image
itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::itkSetInputMacro | ( | LabelInput | , |
TLabelImage | ) |
Set the label image
|
private |
|
static |
Method for creation through the object factory.
|
overrideprotectedvirtual |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from itk::ImageSink< TInputImage >.
void itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::SetHistogramParameters | ( | const int | numBins, |
RealType | lowerBound, | ||
RealType | upperBound ) |
specify Histogram parameters
|
inlineoverridevirtual |
Set the number of pieces to divide the input. The upstream pipeline will be executed this many times.
Reimplemented from itk::ImageSink< TInputImage >.
Definition at line 371 of file itkLabelStatisticsImageFilter.h.
References itk::ImageSink< TInputImage >::SetNumberOfStreamDivisions().
|
virtual |
|
overrideprotected |
|
virtual |
|
virtual |
|
staticconstexpr |
Image related type alias.
Definition at line 96 of file itkLabelStatisticsImageFilter.h.
Referenced by itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelStatistics::LabelStatistics(), and itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelStatistics::LabelStatistics().
|
private |
Definition at line 408 of file itkLabelStatisticsImageFilter.h.
Referenced by BeforeStreamedGenerateData(), GetNumberOfObjects(), and HasLabel().
|
private |
Definition at line 415 of file itkLabelStatisticsImageFilter.h.
|
private |
Definition at line 418 of file itkLabelStatisticsImageFilter.h.
|
private |
Definition at line 413 of file itkLabelStatisticsImageFilter.h.
|
private |
Definition at line 416 of file itkLabelStatisticsImageFilter.h.
|
private |
Definition at line 411 of file itkLabelStatisticsImageFilter.h.
|
private |
Definition at line 409 of file itkLabelStatisticsImageFilter.h.
Referenced by GetValidLabelValues().