diff --git a/Modules/Applications/AppMorphology/app/CMakeLists.txt b/Modules/Applications/AppMorphology/app/CMakeLists.txt index 54374fba3ba1ac8f6ad6e74777f3fc348f7a5164..6bfab46d0f8c03a22e0039bc9a748fa0c5d1f23e 100644 --- a/Modules/Applications/AppMorphology/app/CMakeLists.txt +++ b/Modules/Applications/AppMorphology/app/CMakeLists.txt @@ -17,8 +17,8 @@ otb_create_application( otb_create_application( - NAME MorphologicalProfilesClassification - SOURCES otbMorphologicalProfilesClassification.cxx + NAME MorphologicalClassification + SOURCES otbMorphologicalClassification.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES}) otb_create_application( diff --git a/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesClassification.cxx b/Modules/Applications/AppMorphology/app/otbMorphologicalClassification.cxx similarity index 94% rename from Modules/Applications/AppMorphology/app/otbMorphologicalProfilesClassification.cxx rename to Modules/Applications/AppMorphology/app/otbMorphologicalClassification.cxx index 002f7cf2bb93d8f86368a539237e0b475a41f5df..96c8ded2add9887d3b84939baffdaeb04e2e813e 100644 --- a/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesClassification.cxx +++ b/Modules/Applications/AppMorphology/app/otbMorphologicalClassification.cxx @@ -41,10 +41,10 @@ namespace otb { namespace Wrapper { -class MorphologicalProfilesClassification : public Application { +class MorphologicalClassification : public Application { public: /** Standard class typedefs. */ - typedef MorphologicalProfilesClassification Self; + typedef MorphologicalClassification Self; typedef Application Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; @@ -66,17 +66,17 @@ public: /** Standard macro */ itkNewMacro( Self ); - itkTypeMacro( MorphologicalProfilesClassification, otb::Application ); + itkTypeMacro( MorphologicalClassification, otb::Application ); private: void DoInit() ITK_OVERRIDE { - SetName( "MorphologicalProfilesClassification" ); + SetName( "MorphologicalClassification" ); SetDescription( "Performs morphological convex, concave and flat classification on an input image channel" ); // Documentation - SetDocName( "Morphological Profiles Classification" ); + SetDocName( "Morphological Classification" ); SetDocLongDescription( "This algorithm is based on the following publication:\n" "\n" "Martino Pesaresi and Jon Alti Benediktsson, Member, IEEE: A new approach\n" @@ -94,12 +94,12 @@ private: "\n" ":math:`f(n) = \\begin{cases} \\stackrel{\\smile}{k} &:& f-\\psi_{N}(f)>\\sigma \\\\ \\stackrel{\\frown}{k} &:& \\psi_{N}(f)-f>\\sigma\\\\ \\bar{k}&:&\\mid f - \\psi_{N}(f) \\mid \\leq \\sigma \\end{cases}`" "\n\n" - "This output is a 3 band image." ); + "This output is a labeled image (0 : Flat, 1 : Convex, 2 : Concave)" ); SetDocLimitations( "None" ); SetDocAuthors( "OTB-Team" ); SetDocSeeAlso( "otbConvexOrConcaveClassificationFilter class" ); - AddDocTag( "MorphologicalProfilesClassification" ); + AddDocTag( "MorphologicalClassification" ); AddParameter( ParameterType_InputImage, "in", "Input Image" ); SetParameterDescription( "in", "The input image to be classified." ); @@ -215,5 +215,5 @@ private: } } -OTB_APPLICATION_EXPORT( otb::Wrapper::MorphologicalProfilesClassification ) +OTB_APPLICATION_EXPORT( otb::Wrapper::MorphologicalClassification ) diff --git a/Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx b/Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx index 6fed092149ff89793f2b659fa66b99f869e9e7f7..9a9946a4cf55fb15c9caaa512433fd44009e0998 100644 --- a/Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx +++ b/Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx @@ -99,7 +99,7 @@ private: "The :math:`\\stackrel{\\frown}{f}_{n}` and :math:`\\stackrel{\\frown}{f}_{n}` are membership function for the convex\n" "(resp. concave) objects whose size is comprised between :math:`N_{n-1}` and :math:`N_n`\n" "\n" - "Output is a :math:`3 \\times N` multi-band image, ordered as (leveling_iteration_1, convex_iteration_1, concave_iteration_1, leveling_iteration_2, ...)" ); + "Output convex, concave and leveling images with N bands, where N is the number of levels." ); SetDocLimitations( "None" ); SetDocAuthors( "OTB-Team" ); @@ -110,8 +110,12 @@ private: AddParameter( ParameterType_InputImage, "in", "Input Image" ); SetParameterDescription( "in", "The input image to be classified." ); - AddParameter( ParameterType_OutputImage, "out", "Output Image" ); - SetParameterDescription( "out", "The output image with N * 3 bands" ); + AddParameter( ParameterType_OutputImage, "outconvex", "Output Convex Image" ); + SetParameterDescription( "outconvex", "The output convex image with N bands" ); + AddParameter( ParameterType_OutputImage, "outconcave", "Output Concave Image" ); + SetParameterDescription( "outconcave", "The output concave concave with N bands" ); + AddParameter( ParameterType_OutputImage, "outleveling", "Output Image" ); + SetParameterDescription( "outleveling", "The output leveling image with N bands" ); AddParameter( ParameterType_Int, "channel", "Selected Channel" ); SetParameterDescription( "channel", "The selected channel index for input image" ); @@ -147,7 +151,10 @@ private: SetDocExampleParameterValue("radius", "2"); SetDocExampleParameterValue("levels", "2"); SetDocExampleParameterValue("step", "3"); - SetDocExampleParameterValue("out", "output.tif"); + SetDocExampleParameterValue("outconvex", "convex.tif"); + SetDocExampleParameterValue("outconcave", "concave.tif"); + SetDocExampleParameterValue("outleveling", "leveling.tif"); + } @@ -197,7 +204,6 @@ private: typedef otb::GeodesicMorphologyIterativeDecompositionImageFilter<InputImageType, StructuringElement> TDecompositionImageFilter; typedef typename TDecompositionImageFilter::OutputImageListType TImageList; - typedef typename TImageList::Iterator TImageListIterator; typedef otb::ImageListToVectorImageFilter<TImageList, TOutputVectorImage> TListToVectorImageFilter; typename TDecompositionImageFilter::Pointer decompositionImageFilter; @@ -208,31 +214,21 @@ private: decompositionImageFilter->SetStep( step ); decompositionImageFilter->Update(); - // Retrieving iterators on the results images - TImageListIterator itAnalyse = decompositionImageFilter->GetOutput()->Begin(); - TImageListIterator itConvexMap = decompositionImageFilter->GetConvexOutput()->Begin(); - TImageListIterator itConcaveMap = decompositionImageFilter->GetConcaveOutput()->Begin(); - typename TImageList::Pointer imageList = TImageList::New(); - - // Compose the results images - while ( (itAnalyse != decompositionImageFilter->GetOutput()->End()) - && (itConvexMap != decompositionImageFilter->GetConvexOutput()->End()) - && (itConcaveMap != decompositionImageFilter->GetConcaveOutput()->End()) - ) - { - imageList->PushBack( itAnalyse.Get() ); - imageList->PushBack( itConvexMap.Get() ); - imageList->PushBack( itConcaveMap.Get() ); + typename TListToVectorImageFilter::Pointer levelingListToVectorImageFilter = TListToVectorImageFilter::New(); + typename TListToVectorImageFilter::Pointer concaveListToVectorImageFilter = TListToVectorImageFilter::New(); + typename TListToVectorImageFilter::Pointer convexListToVectorImageFilter = TListToVectorImageFilter::New(); - ++itAnalyse; - ++itConvexMap; - ++itConcaveMap; - } + levelingListToVectorImageFilter->SetInput( decompositionImageFilter->GetOutput() ); + levelingListToVectorImageFilter->Update(); + SetParameterOutputImage( "outleveling", levelingListToVectorImageFilter->GetOutput() ); + + concaveListToVectorImageFilter->SetInput( decompositionImageFilter->GetConcaveOutput() ); + concaveListToVectorImageFilter->Update(); + SetParameterOutputImage( "outconcave", concaveListToVectorImageFilter->GetOutput() ); - typename TListToVectorImageFilter::Pointer listToVectorImageFilter = TListToVectorImageFilter::New(); - listToVectorImageFilter->SetInput( imageList ); - listToVectorImageFilter->Update(); - SetParameterOutputImage( "out", listToVectorImageFilter->GetOutput() ); + convexListToVectorImageFilter->SetInput( decompositionImageFilter->GetConvexOutput() ); + convexListToVectorImageFilter->Update(); + SetParameterOutputImage( "outconvex", convexListToVectorImageFilter->GetOutput() ); } ExtractorFilterType::Pointer m_ExtractorFilter; diff --git a/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx b/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx index f61dc99a6da40c36638c4cd5d5eb3273009abe5b..ee124caef069b77ced36ded434d3dbb6b0e5267b 100644 --- a/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx +++ b/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx @@ -149,8 +149,8 @@ private: SetParameterDescription( "profile", "" ); AddChoice( "profile.opening", "opening" ); AddChoice( "profile.closing", "closing" ); - AddChoice( "profile.derivatedopening", "derivatedopening" ); - AddChoice( "profile.derivatedclosing", "derivatedclosing" ); + AddChoice( "profile.derivativeopening", "derivativeopening" ); + AddChoice( "profile.derivativeclosing", "derivativeclosing" ); AddChoice( "profile.openingcharacteristics", "openingcharacteristics" ); AddChoice( "profile.closingcharacteristics", "closingcharacteristics" ); AddChoice( "profile.classification", "classification" ); @@ -246,17 +246,17 @@ private: bool closing = profile == "closing"; bool characOpening = profile == "openingcharacteristics"; bool characClosing = profile == "closingcharacteristics"; - bool derivatedOpening = profile == "derivatedopening"; - bool derivatedClosing = profile == "derivatedclosing"; + bool derivativeOpening = profile == "derivativeopening"; + bool derivativeClosing = profile == "derivativeclosing"; - bool doOpening = classify || opening || derivatedOpening || characOpening; - bool doClosing = classify || closing || derivatedClosing || characClosing; + bool doOpening = classify || opening || derivativeOpening || characOpening; + bool doClosing = classify || closing || derivativeClosing || characClosing; if ( doOpening ) { performOperations<OpeningProfileFilterType, DerivativeFilterType, MultiScaleCharacteristicsFilterType>( oprofileFilter, oderivativeFilter, omsCharFilter, - opening, derivatedOpening, characOpening, + opening, derivativeOpening, characOpening, profileSize, step, initValue ); if ( !classify ) return; @@ -266,7 +266,7 @@ private: { performOperations<ClosingProfileFilterType, DerivativeFilterType, MultiScaleCharacteristicsFilterType>( cprofileFilter, cderivativeFilter, cmsCharFilter, - closing, derivatedClosing, characClosing, + closing, derivativeClosing, characClosing, profileSize, step, initValue ); if ( !classify ) return; @@ -289,7 +289,7 @@ private: performOperations(typename TProfileFilter::Pointer &profileFilter, typename TDerivativeFilter::Pointer &derivativeFilter, typename TCharacteristicsFilter::Pointer &msCharFilter, - bool profile, bool derivated, bool characteristics, + bool profile, bool derivative, bool characteristics, unsigned int profileSize, unsigned short initValue, unsigned short step) { typedef ImageList<InputImageType> TImageList; @@ -313,7 +313,7 @@ private: derivativeFilter = TDerivativeFilter::New(); derivativeFilter->SetInput( profileFilter->GetOutput() ); - if ( derivated ) + if ( derivative ) { TListToVectorImageFilter::Pointer listToVectorImageFilter = TListToVectorImageFilter::New(); listToVectorImageFilter->SetInput( derivativeFilter->GetOutput() );