13 #ifndef mitkImageStatisticsContainer_h
14 #define mitkImageStatisticsContainer_h
18 #include <itkHistogram.h>
22 #include <boost/variant.hpp>
38 itkFactorylessNewMacro(Self);
114 template <
typename TType>
117 auto value = GetValueNonConverted(name);
118 return boost::get<TType>(value);
131 HistogramType::ConstPointer m_Histogram=
nullptr;
134 using StatisticsMapType = std::map < std::string, StatisticsVariantType, std::less<>>;
136 StatisticsMapType m_Statistics;
212 void PrintSelf(std::ostream &os, itk::Indent indent)
const override;
218 using TimeStepMapType = std::map<TimeStepType, ImageStatisticsObject>;
219 using LabelMapType = std::map<LabelValueType, TimeStepMapType>;
221 LabelMapType m_LabelTimeStep2StatisticsMap;
#define MITKIMAGESTATISTICS_EXPORT
Base class of all data objects.
Container class for storing the computed image statistics.
StatisticNameVector GetExistingStatisticNames() const
Returns the names of statistics that actually have stored values.
bool HasStatistic(const std::string_view name) const
Check whether a statistic with the given name exists.
StatisticNameVector GetAllStatisticNames() const
Returns the names of all statistics (default and custom defined) Additional custom keys are added at ...
void Reset()
Clear all stored statistics and custom names.
boost::variant< RealType, VoxelCountType, IndexType > StatisticsVariantType
static const StatisticNameVector & GetDefaultStatisticNames()
Returns the names of the default statistics.
unsigned long VoxelCountType
TType GetValueConverted(const std::string_view name) const
Converts the requested value to the defined type.
std::vector< std::string > StatisticNameVector
vnl_vector< int > IndexType
void AddStatistic(const std::string_view key, StatisticsVariantType value)
Adds a statistic to the statistics object.
StatisticsVariantType GetValueNonConverted(const std::string_view name) const
Returns the requested value.
const StatisticNameVector & GetCustomStatisticNames() const
Returns the names of all custom statistics (defined at runtime and no default names).
Container class for storing a StatisticsObject for each time step.
const ImageStatisticsObject & GetStatistics(LabelValueType labelValue, TimeStepType timeStep) const
Retrieve the statistics object for a given label and time step.
ImageStatisticsObject::RealType RealType
bool StatisticsExist(LabelValueType labelValue, TimeStepType timeStep) const
Checks if the Time step exists.
mitkClassMacro(ImageStatisticsContainer, mitk::BaseData)
const HistogramType * GetHistogram(LabelValueType labelValue, TimeStepType timeStep) const
bool IgnoresZeroVoxel() const
Check whether this container was computed with zero-voxel ignoring enabled.
ImageStatisticsObject::VoxelCountType VoxelCountType
void Reset()
Delete all stored statistics for all labels and time steps.
ImageStatisticsObject::IndexType IndexType
LabelValueVectorType GetExistingLabelValues() const
Get all label values for which statistics have been stored.
TimeStepVectorType GetExistingTimeSteps(LabelValueType labelValue) const
Get all time steps for which statistics exist for the given label.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
ImageStatisticsObject::StatisticsVariantType StatisticsVariantType
void SetRequestedRegion(const itk::DataObject *) override
Required by BaseData. No-op for this container.
bool VerifyRequestedRegion() override
Required by BaseData. Always returns true.
MultiLabelSegmentation::LabelValueVectorType LabelValueVectorType
itk::Statistics::Histogram< double > HistogramType
MultiLabelSegmentation::LabelValueType LabelValueType
void SetStatistics(LabelValueType labelValue, TimeStepType timeStep, const ImageStatisticsObject &statistics)
Sets the statisticObject for the given Timestep.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Required by BaseData. Always returns false (data is always buffered).
ImageStatisticsContainer()
ImageStatisticsContainer(const ImageStatisticsContainer &other)
std::vector< TimeStepType > TimeStepVectorType
Vector of time step indices.
void SetRequestedRegionToLargestPossibleRegion() override
Required by BaseData. Sets requested region to largest possible. No-op.
bool IsWIP() const
Check whether this container is a work-in-progress placeholder.
static constexpr PixelType UNLABELED_VALUE
Value indicating pixels that are not labeled at all (background).
std::vector< LabelValueType > LabelValueVectorType
mitk::Label::PixelType LabelValueType
Find image slices visible on a given plane.
std::size_t TimeStepType
Type for time step indices (non-negative integers starting from 0).
MITKIMAGESTATISTICS_EXPORT ImageStatisticsContainer::ImageStatisticsObject::StatisticNameVector GetAllStatisticNames(const ImageStatisticsContainer *container)
Collect all statistic names (default and custom) from a single container.