Commit e94caadd authored by remi cresson's avatar remi cresson
Browse files

ENH: remove lsgrm part

parent 1627d23f
......@@ -31,27 +31,24 @@
#include "otbImageList.h"
#include "otbMultiChannelExtractROI.h"
// Vectorization
#include "otbLabelImageToVectorDataFilter.h"
namespace otb
{
namespace Wrapper
{
class LandscapeStratification : public CompositeApplication
class LandscapeStratificationMetric : public CompositeApplication
{
public:
/** Standard class typedefs. */
typedef LandscapeStratification Self;
typedef LandscapeStratificationMetric Self;
typedef Application Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Standard macro */
itkNewMacro(Self);
itkTypeMacro(LandscapeStratification, otb::Wrapper::CompositeApplication);
itkTypeMacro(LandscapeStratificationMetric, otb::Wrapper::CompositeApplication);
/** Typedefs for image concatenation */
typedef otb::ImageList<FloatImageType> ImageListType;
......@@ -62,8 +59,6 @@ public:
typedef otb::MultiChannelExtractROI<FloatVectorImageType::InternalPixelType,
FloatVectorImageType::InternalPixelType> ExtractFilterType;
/** Typedefs for vector data generation */
typedef otb::LabelImageToVectorDataFilter<UInt32ImageType> VectorizationFilterType;
private:
......@@ -71,11 +66,11 @@ private:
void DoInit()
{
SetName("LandscapeStratification");
SetName("LandscapeStratificationMetric");
SetDescription("Compute a landscape stratification metric");
// Documentation
SetDocName("LandscapeStratification");
SetDocName("LandscapeStratificationMetric");
SetDocLongDescription("This application implements the method of Bellon et al. (http://dx.doi.org/10.3390/rs9060600)");
SetDocLimitations("None");
SetDocAuthors("Remi Cresson");
......@@ -86,37 +81,26 @@ private:
// Add applications
AddApplication("ImageTimeSeriesGapFilling", "gapfillling" , "Image time series gap filling" );
AddApplication("DimensionalityReduction" , "pca" , "Principal component analysis" );
AddApplication("LSGRM" , "lsgrm" , "Large scale generic region merging" );
// Fixed parameters
GetInternalApplication("gapfillling")->SetParameterString("it" , "linear" , false );
GetInternalApplication("gapfillling")->SetParameterInt ("comp" , 1 , false );
GetInternalApplication("pca" )->SetParameterString("method" , "pca" , false );
GetInternalApplication("lsgrm" )->SetParameterString("criterion" , "bs" , false );
GetInternalApplication("lsgrm" )->SetParameterString("tiling" , "auto" , false );
// Shared parameters
ShareParameter("mask" , "gapfillling.mask" , "Mask" , "Input time series mask" );
ShareParameter("id" , "gapfillling.id" , "DatesFile" , "Input time series dates file" );
ShareParameter("cw" , "lsgrm.criterion.bs.cw" , "SpectralH" , "Weight for the spectral homogeneity" );
ShareParameter("sw" , "lsgrm.criterion.bs.sw" , "SpatialH" , "Weight for the spatial homogeneity" );
ShareParameter("th" , "lsgrm.threshold" , "Threshold" , "Segmentation threshold (scale factor)" );
ShareParameter("tmpdir", "lsgrm.tmpdir" , "TempDir" , "Temporary directory for segmentation" );
// Input NDVI time series images
AddParameter(ParameterType_InputImageList, "ndvits", "Input NDVI time series images");
// PCA ranges
AddParameter(ParameterType_Int, "cbegin", "Component range begin" );
SetMinimumParameterIntValue ("cbegin", 1);
SetDefaultParameterInt ("cbegin", 2);
MandatoryOff ("cbegin");
AddParameter(ParameterType_Int, "cend" , "Component range end" );
SetMinimumParameterIntValue("cbegin", 1);
SetMinimumParameterIntValue("cend" , 1);
SetDefaultParameterInt ("cbegin", 2);
MandatoryOff("cbegin");
MandatoryOff("cend");
SetMinimumParameterIntValue ("cend" , 1);
MandatoryOff ("cend");
// Output vector
AddParameter(ParameterType_OutputVectorData, "outvec", "Output land units map (vector)");
// Output image
AddParameter(ParameterType_OutputImage, "out", "output metric image");
// ram
AddRAMParameter();
......@@ -215,19 +199,7 @@ private:
m_ExtractChannelsFilter->SetInput(static_cast<FloatVectorImageType*>(
GetInternalApplication("pca")->GetParameterOutputImage("out")));
// Segmentation
FloatVectorImageType::Pointer extractedPCAChans = m_ExtractChannelsFilter->GetOutput();
extractedPCAChans->UpdateOutputInformation();
GetInternalApplication("lsgrm")->SetParameterInputImage("in",
static_cast<FloatVectorImageType*> (extractedPCAChans.GetPointer()));
ExecuteInternal("lsgrm");
// Vectorization
m_VectorizationFilter = VectorizationFilterType::New();
m_VectorizationFilter->SetInput(static_cast<UInt32ImageType*>(
GetInternalApplication("lsgrm")->GetParameterOutputImage("out")));
SetParameterOutputVectorData("outvec", m_VectorizationFilter->GetOutput());
SetParameterOutputImage("out" , m_ExtractChannelsFilter->GetOutput());
} // DOExecute()
......@@ -241,9 +213,9 @@ private:
ExtractROIFilterListType::Pointer m_NDVIExtractorList;
ImageListType::Pointer m_NDVIImageList;
ExtractFilterType::Pointer m_ExtractChannelsFilter;
VectorizationFilterType::Pointer m_VectorizationFilter;
};
}
}
OTB_APPLICATION_EXPORT( otb::Wrapper::LandscapeStratification )
OTB_APPLICATION_EXPORT( otb::Wrapper::LandscapeStratificationMetric )
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