Skip to content
Snippets Groups Projects
Commit be7d3eba authored by Julien Michel's avatar Julien Michel
Browse files

COMP: Missing refactoring in examples

parent 5ea81d80
No related branches found
No related tags found
No related merge requests found
......@@ -35,11 +35,9 @@
// Let's look at the minimal code required to use this algorithm. First, the
// following headers must be included.
#include "otbMultiChannelRAndNIRIndexImageFilter.h"
#include "otbImage.h"
#include "otbImageFileWriter.h"
#include "itkUnaryFunctorImageFilter.h"
#include "otbVegetationIndicesFunctor.h"
#include "otbImage.h"
#include "otbVectorImage.h"
#include "otbImageFileReader.h"
......@@ -63,12 +61,12 @@ int main(int argc, char* argv[])
typedef otb::ImageFileWriter<OutputImageType> WriterType;
typedef otb::ImageFileWriter<ImageVisuType> VisuWriterType;
typedef otb::ImageFileWriter<InputImageType> InWriterType;
// Filter type is a generic \doxygen{otb}{MultiChannelRAndNIRIndexImageFilter} using Formosat2 specific LAI
// Filter type is a generic \doxygen{itk}{UnaryFunctorImageFilter} using Formosat2 specific LAI
// \doxygen{otb}{LAIFromNDVIFormosat2Functor}.
typedef otb::Functor::LAIFromNDVIFormosat2Functor<InputImageType::InternalPixelType, InputImageType::InternalPixelType, OutputImageType::PixelType>
FunctorType;
typedef otb::MultiChannelRAndNIRIndexImageFilter<InputImageType, OutputImageType, FunctorType> MultiChannelRAndNIRIndexImageFilterType;
typedef itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType> MultiChannelRAndNIRIndexImageFilterType;
// Instantiating object
......@@ -98,8 +96,8 @@ int main(int argc, char* argv[])
//
unsigned int redChannel = static_cast<unsigned int>(atoi(argv[5]));
unsigned int nirChannel = static_cast<unsigned int>(atoi(argv[6]));
filter->SetRedIndex(redChannel);
filter->SetNIRIndex(nirChannel);
filter->GetFunctor().SetRedIndex(redChannel);
filter->GetFunctor().SetNIRIndex(nirChannel);
// The invocation of the \code{Update()} method triggers the
// execution of the pipeline.
......
......@@ -23,7 +23,8 @@
#include "otbImage.h"
#include "otbWaterIndicesFunctor.h"
#include "otbMultiChannelRAndGAndNIRIndexImageFilter.h"
#include "otbVegetationIndicesFunctor.h"
#include "itkUnaryFunctorImageFilter.h"
#include "itkBinaryErodeImageFilter.h"
#include "itkBinaryDilateImageFilter.h"
#include "itkBinaryBallStructuringElement.h"
......@@ -183,7 +184,7 @@ public:
// NonVegetationNonWaterIndexFilter
typedef Functor::RadiometricNonWaterNonVegetationDetectionFunctor<VectorImagePixelType,
OutputImagePixelType> FunctorType;
typedef MultiChannelRAndGAndNIRIndexImageFilter <VectorImageType, OutputImageType,
typedef itk::UnaryFunctorImageFilter <VectorImageType, OutputImageType,
FunctorType> UrbanAreaExtractionFilterType;
typedef typename UrbanAreaExtractionFilterType::Pointer
UrbanAreaExtrationFilterPointerType;
......@@ -215,12 +216,12 @@ public:
typedef typename MultiplyImageFilterType::Pointer MultiplyImageFilterPointerType;
/** Get/Set indices */
void SetRedIndex(int id){ m_UrbanAreaExtractionFilter->SetRedIndex(id); }
void SetGreenIndex(int id){ m_UrbanAreaExtractionFilter->SetGreenIndex(id); }
void SetNIRIndex(int id){ m_UrbanAreaExtractionFilter->SetNIRIndex(id); }
unsigned int GetRedIndex(){ return m_UrbanAreaExtractionFilter->GetRedIndex(); }
unsigned int GetGreenIndex(){ return m_UrbanAreaExtractionFilter->GetGreenIndex(); }
unsigned int GetNIRIndex(){ return m_UrbanAreaExtractionFilter->GetNIRIndex(); }
void SetRedIndex(int id){ m_UrbanAreaExtractionFilter->GetFunctor().SetRedIndex(id); }
void SetGreenIndex(int id){ m_UrbanAreaExtractionFilter->GetFunctor().SetGreenIndex(id); }
void SetNIRIndex(int id){ m_UrbanAreaExtractionFilter->GetFunctor().SetNIRIndex(id); }
unsigned int GetRedIndex(){ return m_UrbanAreaExtractionFilter->GetFunctor().GetRedIndex(); }
unsigned int GetGreenIndex(){ return m_UrbanAreaExtractionFilter->GetFunctor().GetGreenIndex(); }
unsigned int GetNIRIndex(){ return m_UrbanAreaExtractionFilter->GetFunctor().GetNIRIndex(); }
/** Get/Set threshold values */
itkGetMacro(ThresholdValue, double);
itkSetMacro(ThresholdValue, double);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment