13 #ifndef mitkMinMaxLabelmageFilterWithIndex_h
14 #define mitkMinMaxLabelmageFilterWithIndex_h
19 #include <itkImageToImageFilter.h>
20 #include <itkImageRegionConstIteratorWithIndex.h>
21 #include <unordered_map>
26 template <
typename TInputImage,
typename TLabelImage>
32 typedef ImageToImageFilter< TInputImage, TInputImage >
Superclass;
43 typedef typename TInputImage::SizeType
SizeType;
46 typedef typename NumericTraits< PixelType >::RealType
RealType;
68 typedef typename std::unordered_map<LabelPixelType, LabelExtrema>
ExtremaMapType;
76 if (it == m_LabelExtrema.end())
81 return (*it).second.m_Min;
87 if (it == m_LabelExtrema.end())
92 return (*it).second.m_Max;
100 std::vector<LabelPixelType> labels;
101 for (
auto&& it:m_LabelExtrema)
103 labels.push_back(it.first);
111 if (it == m_LabelExtrema.end())
116 return (*it).second.m_MinIndex;
123 if (it == m_LabelExtrema.end())
128 return (*it).second.m_MaxIndex;
144 return m_GlobalMinIndex;
149 return m_GlobalMaxIndex;
156 this->SetNthInput( 1,
const_cast< TLabelImage *
>( input ) );
162 return itkDynamicCastInDebugMode< TLabelImage * >(
const_cast< DataObject *
>( this->ProcessObject::GetInput(1) ) );
168 this->DynamicMultiThreadingOff();
174 outputRegionForThread,
175 ThreadIdType threadId)
override;
182 std::vector<ExtremaMapType> m_ThreadExtrema;
187 IndexType m_GlobalMinIndex, m_GlobalMaxIndex;
191 #include "mitkMinMaxLabelmageFilterWithIndex.hxx"
The LabelExtrema class is just a container for global min/max values and their indices as well as all...
ExtremaMapType::const_iterator ExtremaMapTypeConstIterator
TInputImage::PixelType PixelType
IndexType GetGlobalMinIndex() const
PixelType GetMax(LabelPixelType label) const
void AfterThreadedGenerateData() override
TLabelImage::IndexType LabelIndexType
MinMaxLabelImageFilterWithIndex Self
ExtremaMapType::iterator ExtremaMapTypeIterator
void AllocateOutputs() override
std::vector< LabelPixelType > GetRelevantLabels() const
Returns a std::vector containing all labels for which min and max values (and indices) have been comp...
ExtremaMapType::value_type MapValueType
std::unordered_map< LabelPixelType, LabelExtrema > ExtremaMapType
SmartPointer< const Self > ConstPointer
TInputImage::RegionType RegionType
IndexType GetMinIndex(LabelPixelType label) const
TInputImage::IndexType IndexType
TLabelImage::SizeType LabelSizeType
TInputImage::SizeType SizeType
PixelType GetGlobalMin() const
const TLabelImage * GetLabelInput() const
PixelType GetGlobalMax() const
TLabelImage::PixelType LabelPixelType
SmartPointer< Self > Pointer
IndexType GetGlobalMaxIndex() const
PixelType GetMin(LabelPixelType label) const
ImageToImageFilter< TInputImage, TInputImage > Superclass
MinMaxLabelImageFilterWithIndex()
TLabelImage::RegionType LabelRegionType
NumericTraits< PixelType >::RealType RealType
void BeforeThreadedGenerateData() override
IndexType GetMaxIndex(LabelPixelType label) const
void SetLabelInput(const TLabelImage *input)
void ThreadedGenerateData(const RegionType &outputRegionForThread, ThreadIdType threadId) override