43 m_Statistics.emplace(key, value);
45 if (std::find(m_DefaultNames.cbegin(), m_DefaultNames.cend(), key) == m_DefaultNames.cend())
47 if (std::find(m_CustomNames.cbegin(), m_CustomNames.cend(), key) == m_CustomNames.cend())
49 m_CustomNames.emplace_back(key);
57 return m_DefaultNames;
71 names.insert(names.cend(), m_CustomNames.cbegin(), m_CustomNames.cend());
81 std::transform(m_Statistics.begin(), m_Statistics.end(), std::back_inserter(names), [](
const auto &pair) {
90 return m_Statistics.find(name) != m_Statistics.cend();
94 const std::string &name)
const 96 if (HasStatistic(name))
98 return m_Statistics.find(name)->second;
102 mitkThrow() <<
"invalid statistic key, could not find";
108 m_Statistics.clear();
109 m_CustomNames.clear();
114 return m_TimeStepMap.find(timeStep) != m_TimeStepMap.end();
120 auto it = m_TimeStepMap.find(timeStep);
121 if (it != m_TimeStepMap.end())
125 mitkThrow() <<
"StatisticsObject for timeStep " << timeStep <<
" not found!";
132 m_TimeStepMap.emplace(timeStep, statistics);
137 mitkThrow() <<
"Given timeStep " << timeStep
138 <<
" out of timeStep geometry bounds. TimeSteps in geometry: " << this->
GetTimeSteps();
144 Superclass::PrintSelf(os, indent);
148 os << std::endl << indent <<
"Statistics instance for timeStep " << i <<
":";
149 auto statisticKeys = statisticsValues.GetExistingStatisticNames();
150 os << std::endl << indent <<
"Number of entries: " << statisticKeys.size();
151 for (
const auto &aKey : statisticKeys)
153 os << std::endl << indent.GetNextIndent() << aKey <<
": " << statisticsValues.GetValueNonConverted(aKey);
162 for (
auto iter = m_TimeStepMap.begin(); iter != m_TimeStepMap.end(); iter++)
164 iter->second.Reset();
168 itk::LightObject::Pointer ImageStatisticsContainer::InternalClone()
const 170 itk::LightObject::Pointer ioPtr = Superclass::InternalClone();
174 itkExceptionMacro(<<
"downcast to type " 175 <<
"StatisticsContainer" 179 rval->SetTimeStepMap(m_TimeStepMap);
195 std::set<std::string> customKeys;
197 for (
unsigned int i = 0; i < container->
GetTimeSteps(); i++)
200 customKeys.insert(statisticKeys.cbegin(), statisticKeys.cend());
203 names.insert(names.cend(), customKeys.cbegin(), customKeys.cend());
210 std::vector<ImageStatisticsContainer::ConstPointer> containers)
215 std::set<std::string> customKeys;
217 for (
auto container : containers)
219 for (
unsigned int i = 0; i < container->GetTimeSteps(); i++)
221 if(container->TimeStepExists(i))
223 auto statisticKeys = container->GetStatisticsForTimeStep(i).GetCustomStatisticNames();
224 customKeys.insert(statisticKeys.cbegin(), statisticKeys.cend());
229 names.insert(names.end(), customKeys.begin(), customKeys.end());
static const std::string NUMBEROFVOXELS()
void Reset()
Deletes all stored values.
unsigned int GetNumberOfTimeSteps() const
static const std::string MEDIAN()
static const std::string MINIMUMPOSITION()
static const std::string MAXIMUMPOSITION()
Base of all data objects.
static const std::string UPP()
DataCollection - Class to facilitate loading/accessing structured data.
StatisticNameVector GetExistingStatisticNames() const
bool HasStatistic(const std::string &name) const
void AddStatistic(const std::string &key, StatisticsVariantType value)
Adds a statistic to the statistics object.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
const StatisticNameVector & GetCustomStatisticNames() const
Returns the names of all custom statistics (defined at runtime and no default names).
static const std::string RMS()
StatisticNameVector GetAllStatisticNames() const
Returns the names of all statistics (default and custom defined) Additional custom keys are added at ...
static const std::string UNIFORMITY()
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
static const std::string MPP()
ImageStatisticsContainer()
void SetStatisticsForTimeStep(TimeStepType timeStep, ImageStatisticsObject statistics)
Sets the statisticObject for the given Timestep.
ImageStatisticsContainer::ImageStatisticsObject::StatisticNameVector GetAllStatisticNames(const ImageStatisticsContainer *container)
static const StatisticNameVector & GetDefaultStatisticNames()
Returns the names of the default statistics.
static const std::string KURTOSIS()
const ImageStatisticsObject & GetStatisticsForTimeStep(TimeStepType timeStep) const
Returns the statisticObject for the given Timestep.
std::vcl_size_t TimeStepType
static const std::string MINIMUM()
static const std::string SKEWNESS()
MITKMATCHPOINTREGISTRATION_EXPORT ResultImageType::Pointer map(const InputImageType *input, const RegistrationType *registration, bool throwOnOutOfInputAreaError=false, const double &paddingValue=0, const ResultImageGeometryType *resultGeometry=nullptr, bool throwOnMappingError=true, const double &errorValue=0, mitk::ImageMappingInterpolator::Type interpolatorType=mitk::ImageMappingInterpolator::Linear)
static const std::string STANDARDDEVIATION()
static const std::string ENTROPY()
static const std::string MAXIMUM()
boost::variant< RealType, VoxelCountType, IndexType > StatisticsVariantType
unsigned int GetTimeSteps() const
Get the number of time steps from the TimeGeometry As the base data has not a data vector given by it...
bool TimeStepExists(TimeStepType timeStep) const
Checks if the Time step exists.
Container class for storing the computed image statistics.
std::vector< std::string > StatisticNameVector
static const std::string MEAN()
StatisticsVariantType GetValueNonConverted(const std::string &name) const
Returns the requested value.
static const std::string VOLUME()
Container class for storing a StatisticsObject for each timestep.
std::map< TimeStepType, ImageStatisticsObject > TimeStepMapType