Commit cbf002fe authored by Julien Malik's avatar Julien Malik

ENH: move all initialization code of application to DoInit

SetName needs access to DocExample structure, which is created during initialization
parent 42f6baa1
......@@ -73,27 +73,18 @@ public:
;
private:
ComputePolylineFeatureFromImage()
void DoInit()
{
SetName("ComputePolylineFeatureFromImage");
SetDescription(
"Compute a polyline feature descriptors from an input image which are part of the polyline pixels that verify the FeatureExpression");
SetDescription("Compute a polyline feature descriptors from an input image which are part of the polyline pixels that verify the FeatureExpression");
SetDocName("Compute Polyline Feature From Image Application");
SetDocLongDescription("This application computes a polyline feature descriptors from an input image which are part of the polyline pixels that verify the FeatureExpression.");
SetDocLimitations("Since it do not rely on streaming process, take care of the size of input image before launching application.");
SetDocAuthors("OTB-Team");
SetDocSeeAlso(" ");
AddDocTag(Tags::FeatureExtraction);
}
virtual ~ComputePolylineFeatureFromImage()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription("in", "An image from which to compute description.");
......
......@@ -115,9 +115,7 @@ public:
itkTypeMacro(DSFuzzyModelEstimation, otb::Application);
private:
DSFuzzyModelEstimation()
void DoInit()
{
SetName("DSFuzzyModelEstimation");
SetDescription("Estimate feature fuzzy model parameters using 2 vector data (ground truth samples and wrong samples).");
......@@ -129,15 +127,6 @@ private:
SetDocSeeAlso(" ");
AddDocTag(Tags::FeatureExtraction);
}
virtual ~DSFuzzyModelEstimation()
{
}
void DoInit()
{
AddParameter(ParameterType_InputVectorData, "psin", "Input Positive Vector Data");
SetParameterDescription("psin", "Ground truth vector data for positive samples");
......
......@@ -58,9 +58,7 @@ public:
itkTypeMacro(VectorDataDSValidation, otb::Application);
private:
VectorDataDSValidation()
void DoInit()
{
SetName("VectorDataDSValidation");
SetDescription("Vector data validation based on the fusion of features using Dempster-Shafer evidence theory framework.");
......@@ -72,15 +70,8 @@ private:
SetDocSeeAlso(" ");
AddDocTag(Tags::FeatureExtraction);
}
virtual ~VectorDataDSValidation()
{
}
void DoInit()
{
AddParameter(ParameterType_InputVectorData, "in", "Input Vector Data");
SetParameterDescription("in", "Input vector data for validation");
......
......@@ -40,7 +40,7 @@ public:
itkTypeMacro(MultivariateAlterationDetector, otb::Wrapper::Application);
private:
MultivariateAlterationDetector()
void DoInit()
{
SetName("MultivariateAlterationDetector");
SetDescription("Multivariate Alteration Detector");
......@@ -53,14 +53,7 @@ private:
SetDocSeeAlso(" ");
AddDocTag(Tags::FeatureExtraction);
}
virtual ~MultivariateAlterationDetector()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in1", "Input Image 1");
AddParameter(ParameterType_InputImage, "in2", "Input Image 2");
AddParameter(ParameterType_OutputImage, "out", "Change Map");
......
......@@ -41,7 +41,7 @@ public:
itkTypeMacro(ComputeImagesStatistics, otb::Application);
private:
ComputeImagesStatistics()
void DoInit()
{
SetName("ComputeImagesStatistics");
SetDescription("Computes global mean and standard deviation for each band from a set of images and optionally saves the results in an XML file.");
......@@ -53,14 +53,7 @@ private:
AddDocTag(Tags::Learning);
AddDocTag(Tags::Analysis);
}
virtual ~ComputeImagesStatistics()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImageList, "il", "Input images");
SetParameterDescription( "il", "List of input images filenames." );
......
......@@ -56,7 +56,7 @@ public:
typedef ModelType::Pointer ModelPointerType;
private:
ImageSVMClassifier()
void DoInit()
{
SetName("ImageSVMClassifier");
SetDescription("Performs a SVM classification of the input image according to a SVM model file.");
......@@ -70,14 +70,7 @@ private:
SetDocSeeAlso("TrainSVMImagesClassifier, ValidateSVMImagesClassifier, ComputeImagesStatistics");
AddDocTag(Tags::Learning);
}
virtual ~ImageSVMClassifier()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription( "in", "The input Image to classify.");
......
......@@ -169,7 +169,7 @@ public:
itkTypeMacro(KMeansClassification, otb::Application);
private:
KMeansClassification()
void DoInit()
{
SetName("KMeansClassification");
SetDescription("Unsupervised KMeans image classification");
......@@ -179,36 +179,25 @@ private:
SetDocLimitations("None");
SetDocAuthors("OTB-Team");
SetDocSeeAlso(" ");
// Build lut map
m_LutMap["Red"]=ColorMapFilterType::Red;
m_LutMap["Green"]=ColorMapFilterType::Green;
m_LutMap["Blue"]=ColorMapFilterType::Blue;
m_LutMap["Grey"]=ColorMapFilterType::Grey;
m_LutMap["Hot"]=ColorMapFilterType::Hot;
m_LutMap["Cool"]=ColorMapFilterType::Cool;
m_LutMap["Spring"]=ColorMapFilterType::Spring;
m_LutMap["Summer"]=ColorMapFilterType::Summer;
m_LutMap["Autumn"]=ColorMapFilterType::Autumn;
m_LutMap["Winter"]=ColorMapFilterType::Winter;
m_LutMap["Copper"]=ColorMapFilterType::Copper;
m_LutMap["Jet"]=ColorMapFilterType::Jet;
m_LutMap["HSV"]=ColorMapFilterType::HSV;
m_LutMap["OverUnder"]=ColorMapFilterType::OverUnder;
// Build lut map
m_LutMap["Red"] = ColorMapFilterType::Red;
m_LutMap["Green"] = ColorMapFilterType::Green;
m_LutMap["Blue"] = ColorMapFilterType::Blue;
m_LutMap["Grey"] = ColorMapFilterType::Grey;
m_LutMap["Hot"] = ColorMapFilterType::Hot;
m_LutMap["Cool"] = ColorMapFilterType::Cool;
m_LutMap["Spring"] = ColorMapFilterType::Spring;
m_LutMap["Summer"] = ColorMapFilterType::Summer;
m_LutMap["Autumn"] = ColorMapFilterType::Autumn;
m_LutMap["Winter"] = ColorMapFilterType::Winter;
m_LutMap["Copper"] = ColorMapFilterType::Copper;
m_LutMap["Jet"] = ColorMapFilterType::Jet;
m_LutMap["HSV"] = ColorMapFilterType::HSV;
m_LutMap["OverUnder"] = ColorMapFilterType::OverUnder;
AddDocTag(Tags::Segmentation);
AddDocTag(Tags::Learning);
}
virtual ~KMeansClassification()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription("in", "Input image filename.");
AddParameter(ParameterType_OutputImage, "out", "Output Image");
......
......@@ -68,7 +68,7 @@ public:
private:
SOMClassification()
void DoInit()
{
SetName("SOMClassification");
SetDescription("SOM image classification.");
......@@ -82,14 +82,7 @@ private:
AddDocTag(Tags::Segmentation);
AddDocTag(Tags::Learning);
}
virtual ~SOMClassification()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "InputImage");
SetParameterDescription("in", "Input image.");
......@@ -180,12 +173,12 @@ private:
SetDocExampleParameterValue("bi", "1.0");
SetDocExampleParameterValue("bf", "0.1");
SetDocExampleParameterValue("iv", "0");
}
}
void DoUpdateParameters()
{
{
// Nothing to do
}
}
void DoExecute()
{
......
......@@ -124,7 +124,7 @@ public:
typedef otb::VectorDataIntoImageProjectionFilter<VectorDataType, VectorImageType> VectorDataReprojectionType;
private:
TrainSVMImagesClassifier()
void DoInit()
{
SetName("TrainSVMImagesClassifier");
SetDescription("Train a SVM classifier from multiple pairs of images and training vector data.");
......@@ -138,14 +138,6 @@ private:
AddDocTag(Tags::Learning);
}
virtual ~TrainSVMImagesClassifier()
{
}
void DoInit()
{
//Group IO
AddParameter(ParameterType_Group,"io","Input and output data");
SetParameterDescription("io","This group of parameters allows to set input and output data.");
......
......@@ -115,7 +115,7 @@ public:
typedef otb::VectorDataIntoImageProjectionFilter<VectorDataType, VectorImageType> VectorDataReprojectionType;
private:
ValidateSVMImagesClassifier()
void DoInit()
{
SetName("ValidateSVMImagesClassifier");
SetDescription("Estimate the performance of the SVM model with a new set of validation samples and another image.");
......@@ -128,14 +128,6 @@ private:
AddDocTag(Tags::Learning);
}
virtual ~ValidateSVMImagesClassifier()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImageList, "il", "Input Image List");
SetParameterDescription("il", "Input image list filename.");
AddParameter(ParameterType_InputVectorDataList, "vd", "Vector Data List");
......
......@@ -40,7 +40,7 @@ public:
itkTypeMacro(MaximumAutocorrelationFactor, otb::Wrapper::Application);
private:
MaximumAutocorrelationFactor()
void DoInit()
{
SetName("MaximumAutocorrelationFactor");
SetDescription("Perform a Maximum Auto-correlation Factor (MAF) decomposition of the input image.");
......@@ -53,14 +53,6 @@ private:
AddDocTag(Tags::DimensionReduction);
AddDocTag(Tags::Filter);
}
virtual ~MaximumAutocorrelationFactor()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription("in","The input image to apply MAF decomposition on.");
AddParameter(ParameterType_OutputImage, "out", "MAF output");
......
......@@ -111,8 +111,8 @@ public:
typedef otb::ImageFileReader<VectorImageType> InternalReaderType;
private:
FineRegistration()
{
void DoInit()
{
SetName("FineRegistration");
SetDescription("Estimate disparity map between two images.");
......@@ -123,14 +123,7 @@ private:
SetDocSeeAlso(" ");
AddDocTag(Tags::Stereo);
}
virtual ~FineRegistration()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "ref", "Reference Image");
SetParameterDescription( "ref", "The reference image." );
......@@ -232,15 +225,15 @@ private:
SetDocExampleParameterValue("ery", "2");
SetDocExampleParameterValue("mrx", "3");
SetDocExampleParameterValue("mry", "3");
}
}
void DoUpdateParameters()
{
{
// Nothing to do
}
}
void DoExecute()
{
{
FloatVectorImageType::Pointer refImage = GetParameterImage("ref"); // fixed
FloatVectorImageType::Pointer secImage = GetParameterImage("sec"); // moved
......@@ -466,7 +459,7 @@ private:
otbAppLogINFO("Doing warping : OFF");
}
}
}
IntensityFilterType::Pointer m_IntensityRef;
IntensityFilterType::Pointer m_IntensitySec;
......
......@@ -61,7 +61,7 @@ public:
private:
StereoSensorModelToElevationMap()
void DoInit()
{
SetName("StereoSensorModelToElevationMap");
SetDescription("Convert a stereo sensor model to elevation map.");
......@@ -75,14 +75,7 @@ private:
AddDocTag(Tags::Manip);
AddDocTag(Tags::Stereo);
}
virtual ~StereoSensorModelToElevationMap()
{
}
void DoInit()
{
// Mandatory parameters
AddParameter(ParameterType_InputImage, "ref", "Reference");
SetParameterDescription("ref", "The reference image.");
......
......@@ -50,7 +50,7 @@ public:
itkTypeMacro(LineSegmentDetection, otb::Wrapper::Application);
private:
LineSegmentDetection()
void DoInit()
{
SetName("LineSegmentDetection");
SetDescription("Detect line segments in raster");
......@@ -63,17 +63,9 @@ private:
SetDocSeeAlso("On Line demonstration of the LSD algorithm is available here: http://www.ipol.im/pub/algo/gjmr_line_segment_detector/\n");
AddDocTag(Tags::FeatureExtraction);
}
virtual ~LineSegmentDetection()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Input Image");
AddParameter(ParameterType_OutputVectorData, "out", "Output Detected lines");
SetParameterDescription("out"," Output detected line segments (vector data).");
AddParameter(ParameterType_Directory, "dem", "Digital Elevation Model directory");
......
......@@ -99,8 +99,7 @@ public:
itkTypeMacro(HyperspectralUnmixing, otb::Application);
private:
HyperspectralUnmixing()
void DoInit()
{
SetName("HyperspectralUnmixing");
SetDescription("Estimate abundance maps from an hyperspectral image and a set of endmembers.");
......@@ -113,14 +112,7 @@ private:
SetDocSeeAlso("VertexComponentAnalysis");
AddDocTag(Tags::Hyperspectral);
}
virtual ~HyperspectralUnmixing()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Input Image Filename");
SetParameterDescription("in","The hyperspectral data cube to unmix");
......
......@@ -57,8 +57,7 @@ public:
itkTypeMacro(VertexComponentAnalysis, otb::Application);
private:
VertexComponentAnalysis()
void DoInit()
{
SetName("VertexComponentAnalysis");
SetDescription("Find endmembers in hyperspectral images with Vertex Component Analysis");
......@@ -73,14 +72,6 @@ private:
AddDocTag(Tags::Hyperspectral);
AddDocTag(Tags::DimensionReduction);
}
virtual ~VertexComponentAnalysis()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription("in","Input hyperspectral data cube");
......
......@@ -47,7 +47,7 @@ public:
private:
BundleToPerfectSensor()
void DoInit()
{
SetName("BundleToPerfectSensor");
SetDescription("Perform P+XS pansharpening");
......@@ -62,14 +62,7 @@ private:
AddDocTag(Tags::Geometry);
AddDocTag(Tags::Manip);
AddDocTag(Tags::Pansharpening);
}
virtual ~BundleToPerfectSensor()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "inp", "Input PAN Image");
AddParameter(ParameterType_InputImage, "inxs", "Input XS Image");
AddParameter(ParameterType_Directory, "dem", "DEM directory");
......
......@@ -57,7 +57,7 @@ public:
itkTypeMacro(ConvertCartoToGeoPoint, otb::Application);
private:
ConvertCartoToGeoPoint()
void DoInit()
{
SetName("ConvertCartoToGeoPoint");
SetDescription("Convert cartographic coordinates to geographic one.");
......@@ -71,14 +71,7 @@ private:
AddDocTag(Tags::Coordinates);
AddDocTag(Tags::Geometry);
}
virtual ~ConvertCartoToGeoPoint()
{
}
void DoInit()
{
AddParameter(ParameterType_Group, "carto", "Input cartographic coordinates");
AddParameter(ParameterType_Float, "carto.x", "X cartographic coordinates");
SetParameterDescription("carto.x", "X cartographic coordinates in the specified projection.");
......
......@@ -46,7 +46,8 @@ public:
typedef itk::Point<double, 2> PointType;
private:
ConvertSensorToGeoPoint()
void DoInit()
{
SetName("ConvertSensorToGeoPoint");
SetDescription("Convert Sensor Point To Geographic Point using a Forward Sensor Model");
......@@ -59,14 +60,7 @@ private:
SetDocSeeAlso("ConvertCartoToGeoPoint application, otbObtainUTMZoneFromGeoPoint application");
AddDocTag(Tags::Geometry);
}
virtual ~ConvertSensorToGeoPoint()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Sensor image");
AddParameter(ParameterType_Group, "input", "Point Coordinates");
......
......@@ -44,7 +44,7 @@ public:
<FloatVectorImageType, VectorDataType> EnvelopeFilterType;
private:
ImageEnvelope()
void DoInit()
{
SetName("ImageEnvelope");
SetDescription("Extracts an image envelope.");
......@@ -57,14 +57,7 @@ private:
SetDocSeeAlso(" ");
AddDocTag(Tags::Geometry);
}
virtual ~ImageEnvelope()
{
}
void DoInit()
{
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription("in", "Input image.");
......@@ -87,15 +80,15 @@ private:
// Doc example parameter settings
SetDocExampleParameterValue("in", "sensor_stereo_left.tif");
SetDocExampleParameterValue("out", "ImageEnvelope.shp");
}
}
void DoUpdateParameters()
{
{
// Nothing to be done
}
}
void DoExecute()
{
{
FloatVectorImageType::Pointer input = GetParameterImage("in");
m_Envelope = EnvelopeFilterType::New();
......@@ -116,7 +109,7 @@ private:
}
SetParameterOutputVectorData("out", m_Envelope->GetOutput());
}
}
EnvelopeFilterType::Pointer m_Envelope;
......
......@@ -42,6 +42,14 @@ public:
private:
ObtainUTMZoneFromGeoPoint()
{
}
virtual ~ObtainUTMZoneFromGeoPoint()
{
}
void DoInit()
{
SetName("ObtainUTMZoneFromGeoPoint");
SetDescription("UTM zone determination from a geographic point.");
......@@ -54,14 +62,7 @@ private:
SetDocSeeAlso(" ");
AddDocTag(Tags::Coordinates);
}
virtual ~ObtainUTMZoneFromGeoPoint()
{
}
void DoInit()
{
AddParameter(ParameterType_Float, "lat", "Latitude");
SetParameterDescription("lat", "Latitude value of desired point.");
......@@ -76,19 +77,19 @@ private:
SetExampleComment("Obtain a UTM Zone", 0);
SetDocExampleParameterValue("lat","10.0");
SetDocExampleParameterValue("lon","124.0");
}
}
void DoUpdateParameters()
{
{
// Nothing to do
}
}
void DoExecute()
{
{
int utmZone = otb::Utils::GetZoneFromGeoPoint(GetParameterFloat("lon"),
GetParameterFloat("lat"));
SetParameterInt("utm", utmZone);
}
}
};
......
......@@ -83,7 +83,7 @@ public:
typedef otb::BCOInterpolateImageFunction<FloatVectorImageType> BCOInterpolationType;
private:
OrthoRectification()
void DoInit()
{
SetName("OrthoRectification");
std::ostringstream oss;
......@@ -103,10 +103,7 @@ private:
AddDocTag(Tags::Manip);
AddDocTag(Tags::Geometry);
}
void DoInit()
{
// Set the parameters
AddParameter(ParameterType_Group,"io","Input and output data");
SetParameterDescription("io","This group of parameters allows to set the input and output images.");
......
......@@ -45,7 +45,7 @@ public:
private:
RigidTransformResample()
void DoInit()
{
SetName("RigidTransformResample");
SetDescription("Resample an image with a rigid transform");
......@@ -58,14 +58,7 @@ private:
AddDocTag("Conversion");
AddDocTag(Tags::Geometry);
}
virtual ~RigidTransformResample()
{
}
void DoInit()
{