Commit 9f1db6a8 authored by Cresson Remi's avatar Cresson Remi

REFAC: ClassificationMapMosaicFilter --> ClassificationMosaicArgmaxFilter

parent d5cea606
......@@ -17,7 +17,7 @@
#include "itkFixedArray.h"
// Filter
#include "otbClassificationMapMosaicFilter.h"
#include "otbClassificationMosaicArgmaxFilter.h"
namespace otb
{
......@@ -38,8 +38,8 @@ public:
itkNewMacro(Self);
itkTypeMacro(ClassificationMapMosaic, Application);
/** Filter */
typedef otb::ClassificationMapMosaicFilter<FloatVectorImageType, FloatVectorImageType, double> FilterType;
/** Filters */
typedef otb::ClassificationMosaicArgmaxFilter<FloatVectorImageType, FloatVectorImageType, double> ArgmaxFilterType;
void DoUpdateParameters()
{
......@@ -57,6 +57,10 @@ public:
SetDocAuthors("Remi Cresson");
AddParameter(ParameterType_InputImageList, "il", "Input classification maps");
AddParameter(ParameterType_Choice, "mode", "Fusion mode");
AddChoice("mode.argmax", "Argmax of the averages values");
AddParameter(ParameterType_OutputImage, "out", "output classification map");
SetDefaultOutputPixelType("out", ImagePixelType_uint8);
......@@ -67,16 +71,21 @@ public:
// Get the input image list
FloatVectorImageListType::Pointer inputArray = this->GetParameterImageList("il");
m_Filter = FilterType::New();
for (unsigned int i = 0 ; i < inputArray->Size() ; i++)
if (GetParameterAsString("mode") == "argmax")
{
m_Filter->PushBackInput(inputArray->GetNthElement(i) );
otbAppLogINFO("Fusion mode is argmax");
m_ArgmaxMosaicFilter = ArgmaxFilterType::New();
for (unsigned int i = 0 ; i < inputArray->Size() ; i++)
{
m_ArgmaxMosaicFilter->PushBackInput(inputArray->GetNthElement(i) );
}
}
}
private:
FilterType::Pointer m_Filter;
ArgmaxFilterType::Pointer m_ArgmaxMosaicFilter;
}; // end of class
} // end namespace wrapper
......
#ifndef __ClassificationMapMosaicFilter_H
#define __ClassificationMapMosaicFilter_H
/*=========================================================================
Copyright (c) Remi Cresson (IRSTEA). All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __ClassificationMosaicArgmaxFilter_H
#define __ClassificationMosaicArgmaxFilter_H
#include "otbStreamingMosaicFilterBase.h"
namespace otb
{
/** \class ClassificationMapMosaicFilter
/** \class ClassificationMosaicArgmaxFilter
* \brief Computes the mosaic of an input classification map set.
* The filter computes the mosaic of the input classification map.
* For each pixel, the returned value is the argmax.
*
* \ingroup MLUtils
*/
template <class TInputImage, class TOutputImage=TInputImage, class TInternalValueType=double>
class ITK_EXPORT ClassificationMapMosaicFilter : public otb::StreamingMosaicFilterBase<TInputImage, TOutputImage,
class ITK_EXPORT ClassificationMosaicArgmaxFilter : public otb::StreamingMosaicFilterBase<TInputImage, TOutputImage,
TInternalValueType>
{
public:
/** Standard Self typedef */
typedef ClassificationMapMosaicFilter Self;
typedef ClassificationMosaicArgmaxFilter Self;
typedef otb::StreamingMosaicFilterBase<TInputImage, TOutputImage, TInternalValueType> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......@@ -26,7 +38,7 @@ public:
itkNewMacro(Self);
/** Runtime information support. */
itkTypeMacro(ClassificationMapMosaicFilter, StreamingMosaicFilterBase);
itkTypeMacro(ClassificationMosaicArgmaxFilter, StreamingMosaicFilterBase);
/** Input image typedefs. */
typedef typename Superclass::InputImageType InputImageType;
......@@ -47,10 +59,10 @@ public:
typedef typename Superclass::InternalPixelType InternalPixelType;
protected:
ClassificationMapMosaicFilter() {
ClassificationMosaicArgmaxFilter() {
}
virtual ~ClassificationMapMosaicFilter() {
virtual ~ClassificationMosaicArgmaxFilter() {
}
/** Overrided methods */
......@@ -58,7 +70,7 @@ protected:
virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId );
private:
ClassificationMapMosaicFilter(const Self&); //purposely not implemented
ClassificationMosaicArgmaxFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
}; // end of class
......@@ -66,7 +78,7 @@ private:
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbClassificationMapMosaicFilter.txx"
#include "otbClassificationMosaicArgmaxFilter.hxx"
#endif
#endif
#ifndef __ClassificationMapMosaicFilter_txx
#define __ClassificationMapMosaicFilter_txx
/*=========================================================================
#include "otbClassificationMapMosaicFilter.h"
Copyright (c) Remi Cresson (IRSTEA). All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __ClassificationMosaicArgmaxFilter_txx
#define __ClassificationMosaicArgmaxFilter_txx
#include "otbClassificationMosaicArgmaxFilter.h"
namespace otb {
template <class TInputImage, class TOutputImage, class TInternalValueType>
void
ClassificationMapMosaicFilter<TInputImage, TOutputImage, TInternalValueType>
ClassificationMosaicArgmaxFilter<TInputImage, TOutputImage, TInternalValueType>
::GenerateOutputInformation(void)
{
Superclass::GenerateOutputInformation();
......@@ -29,7 +39,7 @@ ClassificationMapMosaicFilter<TInputImage, TOutputImage, TInternalValueType>
*/
template <class TInputImage, class TOutputImage, class TInternalValueType>
void
ClassificationMapMosaicFilter<TInputImage, TOutputImage, TInternalValueType>
ClassificationMosaicArgmaxFilter<TInputImage, TOutputImage, TInternalValueType>
::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment