21 #ifndef otbMinMaxAttributesLabelMapFilter_hxx
22 #define otbMinMaxAttributesLabelMapFilter_hxx
25 #include "itkNumericTraits.h"
30 template <
class TInputImage>
33 this->Superclass::SetNumberOfRequiredOutputs(3);
34 this->itk::ProcessObject::SetNthOutput(1, this->MakeOutput(1).GetPointer());
35 this->itk::ProcessObject::SetNthOutput(2, this->MakeOutput(2).GetPointer());
38 template <
class TInputImage>
46 ret = InputImageType::New();
50 ret = AttributesMapObjectType::New();
57 template <
class TInputImage>
63 template <
class TInputImage>
66 return static_cast<const AttributesMapObjectType*
>(this->itk::ProcessObject::GetOutput(1));
69 template <
class TInputImage>
75 template <
class TInputImage>
78 return static_cast<const AttributesMapObjectType*
>(this->itk::ProcessObject::GetOutput(2));
81 template <
class TInputImage>
84 std::vector<std::string> attributes = this->GetLabelMap()->GetLabelObject(0)->GetAvailableAttributes();
90 std::vector<std::string>::const_iterator valueIt;
91 for (valueIt = attributes.begin(); valueIt != attributes.end(); ++valueIt)
93 minAttr[*valueIt] = itk::NumericTraits<AttributesValueType>::max();
94 maxAttr[*valueIt] = itk::NumericTraits<AttributesValueType>::NonpositiveMin();
98 for (
unsigned int i = 0; i < this->GetLabelMap()->GetNumberOfLabelObjects(); ++i)
100 LabelObjectType* labelObject = this->GetLabelMap()->GetNthLabelObject(i);
101 std::vector<std::string>::const_iterator it;
102 for (it = attributes.begin(); it != attributes.end(); ++it)
106 if (val < minAttr[*it])
109 if (val > maxAttr[*it])