Skip to content
Snippets Groups Projects
Commit 06a65b63 authored by Julien Malik's avatar Julien Malik
Browse files

ENH: make MinMaxAttributesLabelMapFilter derive from InPlaceLabelMapFilter

parent 5256ba4b
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ PURPOSE. See the above copyright notices for more information.
#ifndef __otbMinMaxAttributesLabelMapFilter_h
#define __otbMinMaxAttributesLabelMapFilter_h
#include "itkLabelMapFilter.h"
#include "itkInPlaceLabelMapFilter.h"
#include "itkSimpleDataObjectDecorator.h"
namespace otb {
......@@ -26,33 +26,25 @@ namespace otb {
/** \class MinMaxAttributesLabelMapFilter
* \brief Computes the min/max of all attributes of a itk::LabelMap<otb::AttributesMapLabelObject>
*/
template<class TInputImage, class TOutputImage>
template<class TInputImage>
class ITK_EXPORT MinMaxAttributesLabelMapFilter :
public itk::LabelMapFilter<TInputImage, TOutputImage>
public itk::InPlaceLabelMapFilter<TInputImage>
{
public:
/** Standard class typedefs. */
typedef MinMaxAttributesLabelMapFilter Self;
typedef itk::LabelMapFilter<TInputImage, TOutputImage>
Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef MinMaxAttributesLabelMapFilter Self;
typedef itk::InPlaceLabelMapFilter<TInputImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Some convenient typedefs. */
typedef TInputImage InputImageType;
typedef TOutputImage OutputImageType;
typedef typename InputImageType::Pointer InputImagePointer;
typedef typename InputImageType::ConstPointer InputImageConstPointer;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename InputImageType::PixelType InputImagePixelType;
typedef typename InputImageType::LabelObjectType LabelObjectType;
typedef typename OutputImageType::Pointer OutputImagePointer;
typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef typename OutputImageType::PixelType OutputImagePixelType;
typedef typename OutputImageType::IndexType IndexType;
typedef typename LabelObjectType::AttributesValueType AttributesValueType;
typedef typename LabelObjectType::AttributesMapType AttributesMapType;
typedef itk::SimpleDataObjectDecorator<AttributesMapType> AttributesMapObjectType;
......@@ -60,8 +52,6 @@ public:
/** ImageDimension constants */
itkStaticConstMacro(InputImageDimension, unsigned int,
TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int,
TOutputImage::ImageDimension);
/** Standard New method. */
itkNewMacro(Self);
......
......@@ -23,8 +23,8 @@ PURPOSE. See the above copyright notices for more information.
namespace otb {
template <class TInputImage, class TOutputImage>
MinMaxAttributesLabelMapFilter<TInputImage, TOutputImage>
template <class TInputImage>
MinMaxAttributesLabelMapFilter<TInputImage>
::MinMaxAttributesLabelMapFilter()
{
typename AttributesMapObjectType::Pointer min = AttributesMapObjectType::New();
......@@ -34,41 +34,41 @@ MinMaxAttributesLabelMapFilter<TInputImage, TOutputImage>
this->itk::ProcessObject::SetNthOutput(2, max.GetPointer());
}
template<class TInputImage, class TOutputImage>
typename MinMaxAttributesLabelMapFilter<TInputImage,TOutputImage>::AttributesMapObjectType*
MinMaxAttributesLabelMapFilter<TInputImage,TOutputImage>
template<class TInputImage>
typename MinMaxAttributesLabelMapFilter<TInputImage>::AttributesMapObjectType*
MinMaxAttributesLabelMapFilter<TInputImage>
::GetMinimumOutput()
{
return static_cast<AttributesMapObjectType*>(this->itk::ProcessObject::GetOutput(1));
}
template<class TInputImage, class TOutputImage>
const typename MinMaxAttributesLabelMapFilter<TInputImage,TOutputImage>::AttributesMapObjectType*
MinMaxAttributesLabelMapFilter<TInputImage,TOutputImage>
template<class TInputImage>
const typename MinMaxAttributesLabelMapFilter<TInputImage>::AttributesMapObjectType*
MinMaxAttributesLabelMapFilter<TInputImage>
::GetMinimumOutput() const
{
return static_cast<const AttributesMapObjectType*>(this->itk::ProcessObject::GetOutput(1));
}
template<class TInputImage, class TOutputImage>
typename MinMaxAttributesLabelMapFilter<TInputImage,TOutputImage>::AttributesMapObjectType*
MinMaxAttributesLabelMapFilter<TInputImage,TOutputImage>
template<class TInputImage>
typename MinMaxAttributesLabelMapFilter<TInputImage>::AttributesMapObjectType*
MinMaxAttributesLabelMapFilter<TInputImage>
::GetMaximumOutput()
{
return static_cast<AttributesMapObjectType*>(this->itk::ProcessObject::GetOutput(2));
}
template<class TInputImage, class TOutputImage>
const typename MinMaxAttributesLabelMapFilter<TInputImage,TOutputImage>::AttributesMapObjectType*
MinMaxAttributesLabelMapFilter<TInputImage,TOutputImage>
template<class TInputImage>
const typename MinMaxAttributesLabelMapFilter<TInputImage>::AttributesMapObjectType*
MinMaxAttributesLabelMapFilter<TInputImage>
::GetMaximumOutput() const
{
return static_cast<const AttributesMapObjectType*>(this->itk::ProcessObject::GetOutput(2));
}
template<class TInputImage, class TOutputImage>
template<class TInputImage>
void
MinMaxAttributesLabelMapFilter<TInputImage, TOutputImage>
MinMaxAttributesLabelMapFilter<TInputImage>
::GenerateData()
{
unsigned int nbAttr = this->GetLabelMap()->GetLabelObject(0)->GetNumberOfAttributes();
......
......@@ -41,7 +41,7 @@ typedef otb::ImageFileReader<VectorImageType>
typedef otb::ImageFileReader<LabeledImageType> LabeledReaderType;
typedef otb::LabelImageToLabelMapWithAdjacencyFilter<LabeledImageType,LabelMapType> LabelMapFilterType;
typedef otb::ShapeAttributesLabelMapFilter<LabelMapType> ShapeFilterType;
typedef otb::MinMaxAttributesLabelMapFilter<LabelMapType, VectorImageType> MinMaxAttributesLabelMapFilterType;
typedef otb::MinMaxAttributesLabelMapFilter<LabelMapType> MinMaxAttributesLabelMapFilterType;
int otbMinMaxAttributesLabelMapFilterNew(int argc, char * argv[])
{
......
......@@ -42,7 +42,7 @@ typedef otb::ImageFileReader<VectorImageType>
typedef otb::ImageFileReader<LabeledImageType> LabeledReaderType;
typedef otb::LabelImageToLabelMapWithAdjacencyFilter<LabeledImageType,LabelMapType> LabelMapFilterType;
typedef otb::ShapeAttributesLabelMapFilter<LabelMapType> ShapeFilterType;
typedef otb::MinMaxAttributesLabelMapFilter<LabelMapType, VectorImageType> MinMaxAttributesLabelMapFilterType;
typedef otb::MinMaxAttributesLabelMapFilter<LabelMapType> MinMaxAttributesLabelMapFilterType;
typedef otb::NormalizeAttributesLabelMapFilter<LabelMapType> NormalizeAttributesLabelMapFilterType;
int otbNormalizeAttributesLabelMapFilterNew(int argc, char * argv[])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment