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;
42 typedef typename TInputImage::RegionType
RegionType;
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"