Skip to content
Snippets Groups Projects
Commit 89db766b authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

BUG: avoid overkill MuParser to perform simple affine function (avoid 4-digits...

BUG: avoid overkill MuParser to perform simple affine function (avoid 4-digits MuParser issue on MacOSX)
parent 8c54cfc7
No related branches found
No related tags found
No related merge requests found
......@@ -20,13 +20,13 @@
#include "otbMultiChannelExtractROI.h"
#include "otbExtractROI.h"
#include "otbConnectedComponentMuParserFunctor.h"
#include "otbBandMathImageFilter.h"
#include "itkUnaryFunctorImageFilter.h"
#include "itkStatisticsImageFilter.h"
#include "itkChangeLabelImageFilter.h"
#include "itkImageRegionConstIterator.h"
#include "itkScalarConnectedComponentImageFilter.h"
#include "otbConcatenateVectorImageFilter.h"
#include "otbAffineFunctor.h"
#include "otbMultiToMonoChannelExtractROI.h"
#include "otbImportGeoInformationImageFilter.h"
......@@ -70,13 +70,20 @@ public:
typedef otb::Functor::ConnectedComponentMuParserFunctor<ImageType::PixelType> CCFunctorType;
typedef itk::ConnectedComponentFunctorImageFilter<ImageType, LabelImageType, CCFunctorType, otb::Image<unsigned int> > CCFilterType;
typedef itk::ScalarConnectedComponentImageFilter<LabelImageType, LabelImageType> ScalarCCFilterType;
typedef otb::BandMathImageFilter<LabelImageType> BandMathImageFilterType;
typedef itk::StatisticsImageFilter<LabelImageType> StatisticsImageFilterType;
typedef itk::ChangeLabelImageFilter<LabelImageType,LabelImageType> ChangeLabelImageFilterType;
typedef otb::ImportGeoInformationImageFilter<LabelImageType,ImageType> ImportGeoInformationImageFilterType;
typedef itk::ImageRegionConstIterator<LabelImageType> LabelImageIterator;
typedef otb::ConcatenateVectorImageFilter <ImageType,ImageType,ImageType> ConcatenateType;
typedef otb::Functor::AffineFunctor<
LabelImagePixelType,
LabelImagePixelType,
LabelImagePixelType> AffineFunctorType;
typedef itk::UnaryFunctorImageFilter<
LabelImageType,
LabelImageType,
AffineFunctorType> LabelShiftFilterType;
LSMSSegmentation(): m_FinalReader(),m_ImportGeoInformationFilter(),m_FilesToRemoveAfterExecute(),m_TmpDirCleanup(false){}
......@@ -401,14 +408,12 @@ private:
ccFilter->GetFunctor().SetExpression(expr.str());
ccFilter->Update();
std::stringstream ssexpr;
ssexpr<<"label+"<<regionCount;
//Shifting
BandMathImageFilterType::Pointer labelBandMath = BandMathImageFilterType::New();
labelBandMath->SetNthInput(0,ccFilter->GetOutput(),"label");
labelBandMath->SetExpression(ssexpr.str());
labelBandMath->Update();
LabelShiftFilterType::Pointer labelShiftFilter = LabelShiftFilterType::New();
labelShiftFilter->SetInput(ccFilter->GetOutput());
labelShiftFilter->GetFunctor().SetA(1);
labelShiftFilter->GetFunctor().SetB(regionCount);
labelShiftFilter->Update();
//Maximum label calculation for the shifting
StatisticsImageFilterType::Pointer stats = StatisticsImageFilterType::New();
......@@ -416,7 +421,7 @@ private:
stats->Update();
regionCount+=stats->GetMaximum();
std::string filename = WriteTile(labelBandMath->GetOutput(),row,column,"SEG");
std::string filename = WriteTile(labelShiftFilter->GetOutput(),row,column,"SEG");
}
......
......@@ -17,7 +17,6 @@ otb_module(OTBAppSegmentation
OTBGdalAdapters
OTBApplicationEngine
OTBImageBase
OTBMathParser
OTBCommon
OTBImageManipulation
OTBMorphologicalProfiles
......
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