From 6311a01b56f936da24fb0374b240d6883e809197 Mon Sep 17 00:00:00 2001 From: Julien Malik <julien.malik@c-s.fr> Date: Fri, 15 Nov 2013 15:08:31 +0100 Subject: [PATCH] STYLE: remove trailing whitespace/tab from Applications --- .../otbDSFuzzyModelEstimation.cxx | 2 +- .../otbVectorDataDSValidation.cxx | 4 +- .../otbClassificationMapRegularization.cxx | 20 +-- .../otbComputeConfusionMatrix.cxx | 14 +- .../otbComputeImagesStatistics.cxx | 2 +- .../Classification/otbSOMClassification.cxx | 92 ++++++------- .../DisparityMap/otbBlockMatching.cxx | 8 +- .../DisparityMap/otbFineRegistration.cxx | 124 +++++++++--------- .../otbStereoRectificationGridGenerator.cxx | 4 +- .../otbDimensionalityReduction.cxx | 10 +- .../otbHomologousPointsExtraction.cxx | 76 +++++------ .../otbRadiometricIndices.cxx | 10 +- Applications/Fusion/otbPansharpening.cxx | 8 +- .../otbVertexComponentAnalysis.cxx | 2 +- .../Projections/otbBundleToPerfectSensor.cxx | 18 +-- .../Projections/otbConvertCartoToGeoPoint.cxx | 8 +- .../otbConvertSensorToGeoPoint.cxx | 10 +- .../Projections/otbGenerateRPCSensorModel.cxx | 30 ++--- .../otbGridBasedImageResampling.cxx | 20 +-- Applications/Projections/otbImageEnvelope.cxx | 16 +-- .../otbObtainUTMZoneFromGeoPoint.cxx | 14 +- .../Projections/otbRigidTransformResample.cxx | 6 +- Applications/Projections/otbSuperimpose.cxx | 40 +++--- .../otbSarRadiometricCalibration.cxx | 6 +- .../Rasterization/otbRasterization.cxx | 62 ++++----- .../otbConnectedComponentSegmentation.cxx | 50 +++---- .../otbHooverCompareSegmentation.cxx | 70 +++++----- .../Segmentation/otbLSMSSegmentation.cxx | 78 +++++------ .../otbLSMSSmallRegionsMerging.cxx | 42 +++--- .../Segmentation/otbLSMSVectorization.cxx | 50 +++---- .../Segmentation/otbMeanShiftSmoothing.cxx | 2 +- Applications/Segmentation/otbSegmentation.cxx | 4 +- Applications/Test/otbTestApplication.cxx | 6 +- Applications/Utils/otbBandMath.cxx | 14 +- Applications/Utils/otbColorMapping.cxx | 6 +- Applications/Utils/otbCompareImages.cxx | 28 ++-- Applications/Utils/otbConcatenateImages.cxx | 10 +- .../Utils/otbConcatenateVectorData.cxx | 8 +- Applications/Utils/otbDEMConvert.cxx | 8 +- Applications/Utils/otbExtractROI.cxx | 22 ++-- Applications/Utils/otbKmzExport.cxx | 12 +- .../Utils/otbMultiResolutionPyramid.cxx | 6 +- Applications/Utils/otbOSMDownloader.cxx | 8 +- Applications/Utils/otbPixelValue.cxx | 10 +- Applications/Utils/otbRescale.cxx | 4 +- Applications/Utils/otbSplitImage.cxx | 10 +- Applications/Utils/otbTileFusion.cxx | 18 +-- .../otbVectorDataExtractROIApplication.cxx | 18 +-- Applications/Utils/otbVectorDataSetField.cxx | 8 +- Applications/Utils/otbVectorDataTransform.cxx | 22 ++-- 50 files changed, 560 insertions(+), 560 deletions(-) diff --git a/Applications/CartographicDBValidation/otbDSFuzzyModelEstimation.cxx b/Applications/CartographicDBValidation/otbDSFuzzyModelEstimation.cxx index db499d1705..6e2cb6899f 100644 --- a/Applications/CartographicDBValidation/otbDSFuzzyModelEstimation.cxx +++ b/Applications/CartographicDBValidation/otbDSFuzzyModelEstimation.cxx @@ -125,7 +125,7 @@ private: SetDocLimitations("None."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::FeatureExtraction); AddParameter(ParameterType_InputVectorData, "psin", "Input Positive Vector Data"); diff --git a/Applications/CartographicDBValidation/otbVectorDataDSValidation.cxx b/Applications/CartographicDBValidation/otbVectorDataDSValidation.cxx index 776bddf2d9..bdba236347 100644 --- a/Applications/CartographicDBValidation/otbVectorDataDSValidation.cxx +++ b/Applications/CartographicDBValidation/otbVectorDataDSValidation.cxx @@ -68,7 +68,7 @@ private: SetDocLimitations("None."); SetDocAuthors("OTB-Team"); SetDocSeeAlso("http://en.wikipedia.org/wiki/Dempster-Shafer_theory"); - + AddDocTag(Tags::FeatureExtraction); @@ -102,7 +102,7 @@ private: SetDocExampleParameterValue("belsup", "cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp"); SetDocExampleParameterValue("descmod", "DSFuzzyModel.xml"); SetDocExampleParameterValue("out", "VectorDataDSValidation.shp"); - + } void DoUpdateParameters() diff --git a/Applications/Classification/otbClassificationMapRegularization.cxx b/Applications/Classification/otbClassificationMapRegularization.cxx index fb61a35afc..1ecd2c9dc3 100644 --- a/Applications/Classification/otbClassificationMapRegularization.cxx +++ b/Applications/Classification/otbClassificationMapRegularization.cxx @@ -43,7 +43,7 @@ public: /** Filters typedef */ typedef UInt16ImageType IOLabelImageType; - + // Neighborhood majority voting filter type typedef otb::NeighborhoodMajorityVotingImageFilter<IOLabelImageType> NeighborhoodMajorityVotingFilterType; @@ -98,7 +98,7 @@ private: AddParameter(ParameterType_Int, "ip.undecidedlabel", "Label for the Undecided class"); SetParameterDescription("ip.undecidedlabel", "Label for the Undecided class. By default, 'ip.undecidedlabel = 0'."); SetDefaultParameterInt("ip.undecidedlabel", 0.0); - + AddRAMParameter(); @@ -115,29 +115,29 @@ private: { // Nothing to do here : all parameters are independent } - + void DoExecute() { // Majority Voting m_NeighMajVotingFilter = NeighborhoodMajorityVotingFilterType::New(); - + // Load input labeled image to regularize UInt16ImageType::Pointer inImage = GetParameterUInt16Image("io.in"); - + // Neighborhood majority voting filter settings RadiusType rad; rad[0] = GetParameterInt("ip.radius"); rad[1] = GetParameterInt("ip.radius"); - + StructuringType seBall; seBall.SetRadius(rad); seBall.CreateStructuringElement(); m_NeighMajVotingFilter->SetKernel(seBall); - + m_NeighMajVotingFilter->SetInput(inImage); m_NeighMajVotingFilter->SetLabelForNoDataPixels(GetParameterInt("ip.nodatalabel")); m_NeighMajVotingFilter->SetLabelForUndecidedPixels(GetParameterInt("ip.undecidedlabel")); - + // Set to Undecided label if NOT unique Majority Voting if (IsParameterEnabled("ip.suvbool")) { @@ -148,10 +148,10 @@ private: { m_NeighMajVotingFilter->SetKeepOriginalLabelBool(true); } - + /** REGULARIZATION OF CLASSIFICATION */ SetParameterOutputImage<IOLabelImageType>("io.out", m_NeighMajVotingFilter->GetOutput()); - + }// END DoExecute() diff --git a/Applications/Classification/otbComputeConfusionMatrix.cxx b/Applications/Classification/otbComputeConfusionMatrix.cxx index 02c445bd49..3968684a82 100644 --- a/Applications/Classification/otbComputeConfusionMatrix.cxx +++ b/Applications/Classification/otbComputeConfusionMatrix.cxx @@ -99,20 +99,20 @@ private: AddParameter(ParameterType_OutputFilename, "out", "Matrix output"); SetParameterDescription("out", "Filename to store the output matrix (csv format)"); - + AddParameter(ParameterType_Choice,"ref","Ground truth"); SetParameterDescription("ref","Choice of ground truth format"); - + AddChoice("ref.raster","Ground truth as a raster image"); - + AddChoice("ref.vector","Ground truth as a vector data file"); - + AddParameter(ParameterType_InputImage,"ref.raster.in","Input reference image"); SetParameterDescription("ref.raster.in","Input image containing the ground truth labels"); - + AddParameter(ParameterType_InputFilename,"ref.vector.in","Input reference vector data"); SetParameterDescription("ref.vector.in", "Input vector data of the ground truth"); - + AddParameter(ParameterType_String,"ref.vector.field","Field name"); SetParameterDescription("ref.vector.field","Field name containing the label values"); SetParameterString("ref.vector.field","Class"); @@ -125,7 +125,7 @@ private: SetDefaultParameterInt("nodatalabel",0); MandatoryOff("nodatalabel"); DisableParameter("nodatalabel"); - + AddRAMParameter(); // Doc example parameter settings diff --git a/Applications/Classification/otbComputeImagesStatistics.cxx b/Applications/Classification/otbComputeImagesStatistics.cxx index 5982c9a7b8..a2dac49562 100644 --- a/Applications/Classification/otbComputeImagesStatistics.cxx +++ b/Applications/Classification/otbComputeImagesStatistics.cxx @@ -51,7 +51,7 @@ private: SetDocLimitations("Each image of the set must contain the same bands as the others (i.e. same types, in the same order)."); SetDocAuthors("OTB-Team"); SetDocSeeAlso("Documentation of the TrainImagesClassifier application."); - + AddDocTag(Tags::Learning); AddDocTag(Tags::Analysis); diff --git a/Applications/Classification/otbSOMClassification.cxx b/Applications/Classification/otbSOMClassification.cxx index 903bb559e3..6260b48340 100644 --- a/Applications/Classification/otbSOMClassification.cxx +++ b/Applications/Classification/otbSOMClassification.cxx @@ -66,7 +66,7 @@ public: typedef otb::SOMImageClassificationFilter <FloatVectorImageType, LabeledImageType, SOMMapType> ClassificationFilterType; - + private: void DoInit() { @@ -85,65 +85,65 @@ private: AddParameter(ParameterType_InputImage, "in", "InputImage"); SetParameterDescription("in", "Input image to classify."); - + AddParameter(ParameterType_OutputImage, "out", "OutputImage"); SetParameterDescription("out", "Output classified image (each pixel contains the index of its corresponding vector in the SOM)."); - + AddParameter(ParameterType_InputImage, "vm", "ValidityMask"); SetParameterDescription("vm", "Validity mask (only pixels corresponding to a mask value greater than 0 will be used for learning)"); MandatoryOff("vm"); - + AddParameter(ParameterType_Float, "tp", "TrainingProbability"); SetParameterDescription("tp", "Probability for a sample to be selected in the training set"); MandatoryOff("tp"); - + AddParameter(ParameterType_Int, "ts", "TrainingSetSize"); SetParameterDescription("ts", "Maximum training set size (in pixels)"); MandatoryOff("ts"); - + AddParameter(ParameterType_Int, "sl", "StreamingLines"); SetParameterDescription("sl", "Number of lines in each streaming block (used during data sampling)"); MandatoryOff("sl"); - + AddParameter(ParameterType_OutputImage, "som", "SOM Map"); SetParameterDescription("som","Output image containing the Self-Organizing Map"); MandatoryOff("som"); - + AddParameter(ParameterType_Int, "sx", "SizeX"); SetParameterDescription("sx", "X size of the SOM map"); MandatoryOff("sx"); - + AddParameter(ParameterType_Int, "sy", "SizeY"); SetParameterDescription("sy", "Y size of the SOM map"); MandatoryOff("sy"); - + AddParameter(ParameterType_Int, "nx", "NeighborhoodX"); SetParameterDescription("nx", "X size of the initial neighborhood in the SOM map"); MandatoryOff("nx"); - + AddParameter(ParameterType_Int, "ny", "NeighborhoodY"); SetParameterDescription("ny", "Y size of the initial neighborhood in the SOM map"); MandatoryOff("nx"); - + AddParameter(ParameterType_Int, "ni", "NumberIteration"); SetParameterDescription("ni", "Number of iterations for SOM learning"); MandatoryOff("ni"); - + AddParameter(ParameterType_Float, "bi", "BetaInit"); SetParameterDescription("bi", "Initial learning coefficient"); MandatoryOff("bi"); - + AddParameter(ParameterType_Float, "bf", "BetaFinal"); SetParameterDescription("bf", "Final learning coefficient"); MandatoryOff("bf"); - + AddParameter(ParameterType_Float, "iv", "InitialValue"); SetParameterDescription("iv", "Maximum initial neuron weight"); MandatoryOff("iv"); - + AddRAMParameter(); // TODO : replace StreamingLines by RAM param ? - + AddRANDParameter(); // Default parameters SetDefaultParameterFloat("tp", 1.0); @@ -155,7 +155,7 @@ private: SetDefaultParameterFloat("bi", 1.0); SetDefaultParameterFloat("bf", 0.1); SetDefaultParameterFloat("iv", 0.0); - + // Doc example parameter settings SetDocExampleParameterValue("in", "QB_1_ortho.tif"); SetDocExampleParameterValue("out","SOMClassification.tif"); @@ -171,18 +171,18 @@ private: SetDocExampleParameterValue("bf", "0.1"); SetDocExampleParameterValue("iv", "0"); } - + void DoUpdateParameters() { // Nothing to do } - + void DoExecute() { // initiating random number generation itk::Statistics::MersenneTwisterRandomVariateGenerator::Pointer randomGen = itk::Statistics::MersenneTwisterRandomVariateGenerator::GetInstance(); - + FloatVectorImageType::Pointer input = GetParameterImage("in"); LabeledImageType::Pointer mask; m_UseMask = false; @@ -196,14 +196,14 @@ private: } m_UseMask = true; } - + /*******************************************/ /* Sampling data */ /*******************************************/ otbAppLogINFO("-- SAMPLING DATA --"); - + RegionType largestRegion = input->GetLargestPossibleRegion(); - + // Setting up local streaming capabilities SplitterType::Pointer splitter = SplitterType::New(); unsigned int numberOfStreamDivisions; @@ -223,9 +223,9 @@ private: otb::SET_BUFFER_MEMORY_SIZE, 0, 1048576*GetParameterInt("ram"), 0); } - + otbAppLogINFO("The images will be streamed into "<<numberOfStreamDivisions<<" parts."); - + // Training sample lists ListSampleType::Pointer sampleList = ListSampleType::New(); sampleList->SetMeasurementVectorSize(input->GetNumberOfComponentsPerPixel()); @@ -240,45 +240,45 @@ private: { nbsamples = largestRegion.GetNumberOfPixels(); } - + // Sample dimension and max dimension unsigned int sampleSize = input->GetNumberOfComponentsPerPixel(); unsigned int totalSamples = 0; otbAppLogINFO("The following sample size will be used: "<<sampleSize); - + // local streaming variables unsigned int piece = 0; RegionType streamingRegion; - + // create a random permutation to explore itk::RandomPermutation randPerm(numberOfStreamDivisions); unsigned int index = 0; - + // TODO : maybe change the approach: at the moment, the sampling process is able to pick a sample twice or more while (totalSamples < nbsamples) { unsigned int localNbSamples=0; - + piece = randPerm[index]; streamingRegion = splitter->GetSplit(piece, numberOfStreamDivisions, largestRegion); //otbAppLogINFO("Processing region: "<<streamingRegion); - + input->SetRequestedRegion(streamingRegion); input->PropagateRequestedRegion(); input->UpdateOutputData(); - + IteratorType it(input, streamingRegion); it.GoToBegin(); - + if (m_UseMask) { mask->SetRequestedRegion(streamingRegion); mask->PropagateRequestedRegion(); mask->UpdateOutputData(); - + LabeledIteratorType maskIt(mask, streamingRegion); maskIt.GoToBegin(); - + // Loop on the image and the mask while ( !it.IsAtEnd() && !maskIt.IsAtEnd() @@ -338,17 +338,17 @@ private: if (index == numberOfStreamDivisions) index = 0; } } - + otbAppLogINFO("The final training set contains "<<totalSamples<<" samples."); - + /*******************************************/ /* Learning */ /*******************************************/ otbAppLogINFO("-- LEARNING --"); - + EstimatorType::Pointer estimator = EstimatorType::New(); - + estimator->SetListSample(sampleList); EstimatorType::SizeType size; size[0]=GetParameterInt("sx"); @@ -362,29 +362,29 @@ private: estimator->SetBetaInit(GetParameterFloat("bi")); estimator->SetBetaEnd(GetParameterFloat("bf")); estimator->SetMaxWeight(GetParameterFloat("iv")); - + AddProcess(estimator,"Learning"); estimator->Update(); - + m_SOMMap = estimator->GetOutput(); if (HasValue("som")) { otbAppLogINFO("-- Using Leaning image --"); SetParameterOutputImage<DoubleVectorImageType>("som", m_SOMMap); } - + /*******************************************/ /* Classification */ /*******************************************/ otbAppLogINFO("-- CLASSIFICATION --"); - + m_Classifier = ClassificationFilterType::New(); m_Classifier->SetInput(input); m_Classifier->SetMap(m_SOMMap); if (m_UseMask) m_Classifier->SetInputMask(mask); - + AddProcess(m_Classifier,"Classification"); - + SetParameterOutputImage<LabeledImageType>("out", m_Classifier->GetOutput()); } diff --git a/Applications/DisparityMap/otbBlockMatching.cxx b/Applications/DisparityMap/otbBlockMatching.cxx index 0586c25f9e..3d80e360f4 100644 --- a/Applications/DisparityMap/otbBlockMatching.cxx +++ b/Applications/DisparityMap/otbBlockMatching.cxx @@ -234,18 +234,18 @@ private: AddChoice("bm.subpixel.dichotomy", "Dichotomy"); SetParameterDescription("bm.subpixel.dichotomy", "Dichotomic search"); - + AddParameter(ParameterType_Int,"bm.step", "Computation step"); SetParameterDescription("bm.step", "Location step between computed disparities"); SetDefaultParameterInt("bm.step",1); SetMinimumParameterIntValue("bm.step",1); MandatoryOff("bm.step"); - + AddParameter(ParameterType_Int,"bm.startx","X start index"); SetParameterDescription("bm.startx","X start index of the subsampled grid (wrt the input image grid)"); SetDefaultParameterInt("bm.startx",0); MandatoryOff("bm.startx"); - + AddParameter(ParameterType_Int,"bm.starty","Y start index"); SetParameterDescription("bm.starty","Y start index of the subsampled grid (wrt the input image grid)"); SetDefaultParameterInt("bm.starty",0); @@ -367,7 +367,7 @@ private: int minvdisp = GetParameterInt("bm.minvd"); int maxvdisp = GetParameterInt("bm.maxvd"); unsigned int step = GetParameterInt("bm.step"); - + FloatImageType::IndexType gridIndex; gridIndex[0] = GetParameterInt("bm.startx"); gridIndex[1] = GetParameterInt("bm.starty"); diff --git a/Applications/DisparityMap/otbFineRegistration.cxx b/Applications/DisparityMap/otbFineRegistration.cxx index d3c04f8210..23f993bd3a 100644 --- a/Applications/DisparityMap/otbFineRegistration.cxx +++ b/Applications/DisparityMap/otbFineRegistration.cxx @@ -126,95 +126,95 @@ private: AddParameter(ParameterType_InputImage, "ref", "Reference Image"); SetParameterDescription( "ref", "The reference image." ); - + AddParameter(ParameterType_InputImage, "sec", "Secondary Image"); SetParameterDescription( "sec", "The secondary image." ); - + AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription( "out", "The output image." ); - + AddParameter(ParameterType_Int, "erx", "Exploration Radius X"); SetParameterDescription( "erx", "The exploration radius along x (in pixels)" ); SetMinimumParameterIntValue("erx", 0); - + AddParameter(ParameterType_Int, "ery", "Exploration Radius Y"); SetParameterDescription( "ery", "The exploration radius along y (in pixels)" ); SetMinimumParameterIntValue("ery", 0); - + AddParameter(ParameterType_Int, "mrx", "Metric Radius X"); SetParameterDescription( "mrx", "Radius along x (in pixels) of the metric computation window" ); SetMinimumParameterIntValue("mrx", 0); - + AddParameter(ParameterType_Int, "mry", "Metric Radius Y"); SetParameterDescription( "mry", "Radius along y (in pixels) of the metric computation window" ); SetMinimumParameterIntValue("mry", 0); - + AddParameter(ParameterType_InputImage, "w", "Image To Warp"); SetParameterDescription( "w", "The image to warp after disparity estimation is completed" ); MandatoryOff("w"); - + AddParameter(ParameterType_OutputImage, "wo", "Output Warped Image"); SetParameterDescription( "wo", "The output warped image" ); MandatoryOff("wo"); - + AddParameter(ParameterType_Float, "cox", "Coarse Offset X"); SetParameterDescription( "cox", "Coarse offset along x (in physical space) between the two images" ); SetDefaultParameterFloat("cox", 0.0); MandatoryOff("cox"); - + AddParameter(ParameterType_Float, "coy", "Coarse Offset Y"); SetParameterDescription( "coy", "Coarse offset along y (in physical space) between the two images" ); SetDefaultParameterFloat("coy", 0.0); MandatoryOff("coy"); - + AddParameter(ParameterType_Float, "ssrx", "Sub-Sampling Rate X"); SetParameterDescription( "ssrx", "Generates a result at a coarser resolution with a given sub-sampling rate along X" ); SetDefaultParameterFloat("ssrx", 1.0); SetMinimumParameterFloatValue("ssrx", 1.0); MandatoryOff("ssrx"); - + AddParameter(ParameterType_Float, "ssry", "Sub-Sampling Rate Y"); SetParameterDescription( "ssry", "Generates a result at a coarser resolution with a given sub-sampling rate along Y" ); SetDefaultParameterFloat("ssry", 1.0); SetMinimumParameterFloatValue("ssry", 1.0); MandatoryOff("ssry"); - + AddParameter(ParameterType_Float, "rgsx", "Reference Gaussian Smoothing X"); SetParameterDescription( "rgsx", "Performs a gaussian smoothing of the reference image. Parameter is gaussian sigma (in pixels) in X direction." ); MandatoryOff("rgsx"); - + AddParameter(ParameterType_Float, "rgsy", "Reference Gaussian Smoothing Y"); SetParameterDescription( "rgsy", "Performs a gaussian smoothing of the reference image. Parameter is gaussian sigma (in pixels) in Y direction." ); MandatoryOff("rgsy"); - + AddParameter(ParameterType_Float, "sgsx", "Secondary Gaussian Smoothing X"); SetParameterDescription( "sgsx", "Performs a gaussian smoothing of the secondary image. Parameter is gaussian sigma (in pixels) in X direction." ); MandatoryOff("sgsx"); - + AddParameter(ParameterType_Float, "sgsy", "Secondary Gaussian Smoothing Y"); SetParameterDescription( "sgsy", "Performs a gaussian smoothing of the secondary image. Parameter is gaussian sigma (in pixels) in Y direction." ); MandatoryOff("sgsy"); - + AddParameter(ParameterType_String, "m", "Metric"); SetParameterDescription( "m", "Choose the metric used for block matching. Available metrics are cross-correlation (CC), cross-correlation with subtracted mean (CCSM), mean-square difference (MSD), mean reciprocal square difference (MRSD) and mutual information (MI). Default is cross-correlation" ); MandatoryOff("m"); - + AddParameter(ParameterType_Float, "spa", "SubPixelAccuracy"); SetParameterDescription( "spa", "Metric extrema location will be refined up to the given accuracy. Default is 0.01" ); SetDefaultParameterFloat("spa", 0.01); SetMinimumParameterFloatValue("spa", 0.0); MandatoryOff("spa"); - + AddParameter(ParameterType_Float, "vmlt", "Validity Mask Lower Threshold"); SetParameterDescription( "vmlt", "Lower threshold to obtain a validity mask." ); MandatoryOff("vmlt"); - + AddParameter(ParameterType_Float, "vmut", "Validity Mask Upper Threshold"); SetParameterDescription( "vmut", "Upper threshold to obtain a validity mask." ); MandatoryOff("vmut"); - + AddRAMParameter(); - + // Doc example parameter settings SetDocExampleParameterValue("ref", "StereoFixed.png"); SetDocExampleParameterValue("sec", "StereoMoving.png"); @@ -234,13 +234,13 @@ private: { FloatVectorImageType::Pointer refImage = GetParameterImage("ref"); // fixed FloatVectorImageType::Pointer secImage = GetParameterImage("sec"); // moved - + m_IntensityRef = IntensityFilterType::New(); m_IntensitySec = IntensityFilterType::New(); - + m_IntensityRef->SetInput(refImage); m_IntensitySec->SetInput(secImage); - + // Retrieve main registration parameters RegistrationFilterType::SizeType radius, sradius; RegistrationFilterType::OffsetType ssrate; @@ -248,16 +248,16 @@ private: sradius[1] = GetParameterInt("ery"); radius[0] = GetParameterInt("mrx"); radius[1] = GetParameterInt("mry"); - + double accuracy = static_cast<double>(GetParameterFloat("spa")); - + ssrate[0] = GetParameterFloat("ssrx"); ssrate[1] = GetParameterFloat("ssry"); - + RegistrationFilterType::SpacingType initialOffset; initialOffset[0] = GetParameterFloat("cox"); initialOffset[1] = GetParameterFloat("coy"); - + // Display info otbAppLogINFO("Reference image : "<<GetParameterString("ref")); otbAppLogINFO("Secondary image : "<<GetParameterString("sec")); @@ -266,14 +266,14 @@ private: otbAppLogINFO("Sub-sampling rate : "<<ssrate<<" (pixels)"); otbAppLogINFO("Coarse offset : "<<initialOffset<<" (physical unit)"); otbAppLogINFO("Accuracy : "<<accuracy<<" (physical unit)"); - + m_Registration = RegistrationFilterType::New(); m_Registration->SetRadius(radius); m_Registration->SetSearchRadius(sradius); m_Registration->SetSubPixelAccuracy(accuracy); m_Registration->SetGridStep(ssrate); m_Registration->SetInitialOffset(initialOffset); - + if(HasValue("rgsx") && HasValue("rgsy")) { m_RefGaussianFilter = GaussianFilterType::New(); @@ -292,7 +292,7 @@ private: otbAppLogINFO("Reference image gaussian smoothing : OFF"); m_Registration->SetFixedInput(m_IntensityRef->GetOutput()); } - + if(HasValue("sgsx") && HasValue("sgsy")) { m_SecGaussianFilter = GaussianFilterType::New(); @@ -311,14 +311,14 @@ private: otbAppLogINFO("Secondary image gaussian smoothing : OFF"); m_Registration->SetMovingInput(m_IntensitySec->GetOutput()); } - + // Retrieve metric name std::string metricId = "CC"; if(HasValue("m")) { metricId = GetParameterString("m"); } - + if(metricId == "CC") { otbAppLogINFO("Metric : Cross-correlation"); @@ -360,19 +360,19 @@ private: { itkExceptionMacro("Metric not recognized. Possible choices are: CC, CCSM, MSD, MRSD, MI"); } - + m_XExtractor = VectorImageToImageFilterType::New(); m_XExtractor->SetInput(m_Registration->GetOutputDisplacementField()); m_XExtractor->SetIndex(0); - + m_YExtractor = VectorImageToImageFilterType::New(); m_YExtractor->SetInput(m_Registration->GetOutputDisplacementField()); m_YExtractor->SetIndex(1); - + m_ImgList = ImageListType::New(); m_ImgList->PushBack(m_XExtractor->GetOutput()); m_ImgList->PushBack(m_YExtractor->GetOutput()); - + // Invert correlation to get classical rendering if(metricId == "CC" || metricId == "CCSM") { @@ -384,13 +384,13 @@ private: { m_ImgList->PushBack(m_Registration->GetOutput()); } - + m_Registration->UpdateOutputInformation(); - + if(HasUserValue("vmlt") || HasUserValue("vmut")) { m_Threshold = BinaryThresholdImageFilterType::New(); - + if(metricId == "CC" || metricId == "CCSM") { m_Threshold->SetInput(m_AbsFilter->GetOutput()); @@ -399,7 +399,7 @@ private: { m_Threshold->SetInput(m_Registration->GetOutput()); } - + otbAppLogINFO("A validity mask will be produced as the 4th band (valid pixels = 1.0, not valid = 0.0)."); if(HasUserValue("vmlt")) { @@ -411,52 +411,52 @@ private: m_Threshold->SetUpperThreshold(GetParameterFloat("vmut")); otbAppLogINFO("The upper threshold is set to "<<GetParameterFloat("vmut")); } - + m_Threshold->SetInsideValue(1.0); m_Threshold->SetOutsideValue(0.); m_ImgList->PushBack(m_Threshold->GetOutput()); } - + m_Il2vi = IL2VIFilterType::New(); m_Il2vi->SetInput(m_ImgList); - + AddProcess(m_Registration,"Fine Registration"); - + SetParameterOutputImage<VectorImageType>("out", m_Il2vi->GetOutput()); - + // If an image to warp has been given if (HasValue("w") && HasValue("wo")) { otbAppLogINFO("Doing warping : ON"); - + m_outputReader = InternalReaderType::New(); m_outputReader->SetFileName(GetParameterString("out")); - + m_ExtractROIFilter = ExtractROIFilterType::New(); m_ExtractROIFilter->SetChannel(1); m_ExtractROIFilter->SetChannel(2); m_ExtractROIFilter->SetInput(m_outputReader->GetOutput()); - + m_Cast = CastFilterType::New(); m_Cast->SetInput(m_ExtractROIFilter->GetOutput()); - + FloatVectorImageType::Pointer imageToWarp = GetParameterImage("w"); - + m_Warp = WarpFilterType::New(); m_Warp->SetDisplacementField(m_Cast->GetOutput()); m_Warp->SetInput(imageToWarp); m_Warp->SetOutputParametersFromImage(refImage); - + AddProcess(m_Warp,"Warp"); - + SetParameterOutputImage("wo", m_Warp->GetOutput()); - + } else { otbAppLogINFO("Doing warping : OFF"); } - + } IntensityFilterType::Pointer m_IntensityRef; @@ -465,22 +465,22 @@ private: GaussianFilterType::Pointer m_RefGaussianFilter, m_SecGaussianFilter; itk::ImageToImageMetric<ScalarImageType, ScalarImageType>::Pointer m_MetricPtr; NCCType::Pointer m_NCCMetricPtr; // special case because of the SubtractMeanOn/Off method - + VectorImageToImageFilterType::Pointer m_XExtractor; VectorImageToImageFilterType::Pointer m_YExtractor; - + AbsFilterType::Pointer m_AbsFilter; ImageListType::Pointer m_ImgList; - + BinaryThresholdImageFilterType::Pointer m_Threshold; - + IL2VIFilterType::Pointer m_Il2vi; - + InternalReaderType::Pointer m_outputReader; ExtractROIFilterType::Pointer m_ExtractROIFilter; CastFilterType::Pointer m_Cast; WarpFilterType::Pointer m_Warp; - + }; } diff --git a/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx b/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx index 9ee3b121bf..3687ca1b72 100644 --- a/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx +++ b/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx @@ -213,7 +213,7 @@ private: // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"epi.elevation"); - + if (otb::Wrapper::ElevationParametersHandler::IsGeoidUsed(this,"epi.elevation") && otb::Wrapper::ElevationParametersHandler::IsDEMUsed(this,"epi.elevation") && !IsParameterEnabled("epi.elevation.avgdem.step")) @@ -244,7 +244,7 @@ private: m_StatisticsFilter->Update(); otb::DEMHandler::Instance()->SetDefaultHeightAboveEllipsoid(m_StatisticsFilter->GetMean()); - + EnableParameter("epi.elevation.avgdem.value"); SetParameterFloat("epi.elevation.avgdem.value",m_StatisticsFilter->GetMean()); diff --git a/Applications/FeatureExtraction/otbDimensionalityReduction.cxx b/Applications/FeatureExtraction/otbDimensionalityReduction.cxx index f245c1b165..43c5e8a4f1 100644 --- a/Applications/FeatureExtraction/otbDimensionalityReduction.cxx +++ b/Applications/FeatureExtraction/otbDimensionalityReduction.cxx @@ -246,7 +246,7 @@ private: PCAInverseFilterType::Pointer invFilter = PCAInverseFilterType::New(); m_InverseFilter = invFilter; - + filter->SetInput(GetParameterFloatVectorImage("in")); filter->SetNumberOfPrincipalComponentsRequired(nbComp); @@ -269,7 +269,7 @@ private: } m_TransformationMatrix = filter->GetTransformationMatrix(); - + break; } case 1: @@ -289,7 +289,7 @@ private: NAPCAInverseFilterType::Pointer invFilter = NAPCAInverseFilterType::New(); m_InverseFilter = invFilter; - + filter->SetInput(GetParameterFloatVectorImage("in")); filter->SetNumberOfPrincipalComponentsRequired(nbComp); filter->SetUseNormalization(normalize); @@ -308,7 +308,7 @@ private: invFilter->SetTransformationMatrix(filter->GetTransformationMatrix()); m_TransformationMatrix = invFilter->GetTransformationMatrix(); } - + m_TransformationMatrix = filter->GetTransformationMatrix(); break; @@ -446,7 +446,7 @@ private: SetParameterOutputImage("out", m_RescaleFilter->GetOutput()); } - + } diff --git a/Applications/FeatureExtraction/otbHomologousPointsExtraction.cxx b/Applications/FeatureExtraction/otbHomologousPointsExtraction.cxx index ef9e84acc0..d3788fc7ee 100644 --- a/Applications/FeatureExtraction/otbHomologousPointsExtraction.cxx +++ b/Applications/FeatureExtraction/otbHomologousPointsExtraction.cxx @@ -126,7 +126,7 @@ private: AddParameter(ParameterType_Choice,"algorithm","Keypoints detection algorithm"); SetParameterDescription("algorithm","Choice of the detection algorithm to use"); - + AddChoice("algorithm.surf","SURF algorithm"); AddChoice("algorithm.sift","SIFT algorithm"); @@ -160,10 +160,10 @@ private: AddParameter(ParameterType_Float,"precision","Estimated precision of the colocalisation function (in pixels)."); SetParameterDescription("precision","Estimated precision of the colocalisation function in pixels"); SetDefaultParameterFloat("precision",0.); - + AddParameter(ParameterType_Empty,"mfilter","Filter points according to geographical or sensor based colocalisation"); SetParameterDescription("mfilter","If enabled, this option allows to filter matches according to colocalisation from sensor or geographical information, using the given tolerancy expressed in pixels"); - + AddParameter(ParameterType_Empty,"2wgs84","If enabled, points from second image will be exported in WGS84"); // Elevation @@ -198,18 +198,18 @@ private: otbAppLogINFO("Using SIFT points"); SiftFilterType::Pointer sift1 = SiftFilterType::New(); sift1->SetInput(im1); - + SiftFilterType::Pointer sift2 = SiftFilterType::New(); sift2->SetInput(im2); - + sift1->Update(); - + otbAppLogINFO("Found " << sift1->GetOutput()->GetNumberOfPoints()<<" sift points in image 1."); - + sift2->Update(); - + otbAppLogINFO("Found " << sift2->GetOutput()->GetNumberOfPoints()<<" sift points in image 2."); - + matchingFilter->SetInput1(sift1->GetOutput()); matchingFilter->SetInput2(sift2->GetOutput()); } @@ -217,19 +217,19 @@ private: { SurfFilterType::Pointer surf1 = SurfFilterType::New(); surf1->SetInput(im1); - + SurfFilterType::Pointer surf2 = SurfFilterType::New(); surf2->SetInput(im2); - + otbAppLogINFO("Doing update"); surf1->Update(); - + otbAppLogINFO("Found " << surf1->GetOutput()->GetNumberOfPoints()<<" surf points in image 1."); - + surf2->Update(); - + otbAppLogINFO("Found " << surf2->GetOutput()->GetNumberOfPoints()<<" surf points in image 2."); - + matchingFilter->SetInput1(surf1->GetOutput()); matchingFilter->SetInput2(surf2->GetOutput()); matchingFilter->SetDistanceThreshold(GetParameterFloat("threshold")); @@ -240,48 +240,48 @@ private: { matchingFilter->Update(); - + LandmarkListType::Pointer landmarks = matchingFilter->GetOutput(); - + otbAppLogINFO("Found " << landmarks->Size() <<" homologous points."); - + unsigned int discarded = 0; - + for (LandmarkListType::Iterator it = landmarks->Begin(); it != landmarks->End(); ++it) { PointType point1 = it.Get()->GetPoint1(); PointType point2 = it.Get()->GetPoint2(); - + double error = 0; PointType pprime1,pprime2; - + bool filtered = false; - + if(IsParameterEnabled("mfilter")) { pprime1 = rsTransform->TransformPoint(point1); error = vcl_sqrt((point2[0]-pprime1[0])*(point2[0]-pprime1[0])+(point2[1]-pprime1[1])*(point2[1]-pprime1[1])); - + if(error>GetParameterFloat("precision")*vcl_sqrt(vcl_abs(im2->GetSpacing()[0]*im2->GetSpacing()[1]))) { filtered = true; } } - + if(!filtered) { if(IsParameterEnabled("2wgs84")) { pprime2 = rsTransform2ToWGS84->TransformPoint(point2); - + file<<point1[0]<<"\t"<<point1[1]<<"\t"<<pprime2[0]<<"\t"<<pprime2[1]<<std::endl; } else { file<<point1[0]<<"\t"<<point1[1]<<"\t"<<point2[0]<<"\t"<<point2[1]<<std::endl; } - + if(mls) { pprime1 = rsTransform1ToWGS84->TransformPoint(point1); @@ -306,7 +306,7 @@ private: // silent catch } } - + void DoExecute() { @@ -337,11 +337,11 @@ private: ExtractChannelFilterType::Pointer extractChannel1 = ExtractChannelFilterType::New(); extractChannel1->SetInput(this->GetParameterImage("in1")); extractChannel1->SetChannel(GetParameterInt("band1")); - + ExtractChannelFilterType::Pointer extractChannel2 = ExtractChannelFilterType::New(); extractChannel2->SetInput(this->GetParameterImage("in2")); extractChannel2->SetChannel(GetParameterInt("band2")); - + // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); @@ -367,7 +367,7 @@ private: FloatImageType::SpacingType spacing1 = this->GetParameterImage("in1")->GetSpacing(); FloatImageType::PointType origin1 = this->GetParameterImage("in1")->GetOrigin(); - + FloatVectorImageType::Pointer image2 = this->GetParameterImage("in2"); for(unsigned int i = 0; i<nb_bins_x; ++i) @@ -376,7 +376,7 @@ private: { unsigned int startx = bin_step/2 + i*(bin_size + bin_step); unsigned int starty = bin_step/2 + j*(bin_size + bin_step); - + FloatImageType::SizeType size1; FloatImageType::IndexType index1; @@ -394,10 +394,10 @@ private: otbAppLogINFO("("<<i+1<<"/"<<nb_bins_x<<", "<<j+1<<"/"<<nb_bins_y<<") Considering region1 : "<<region1.GetIndex()<<", "<<region1.GetSize()); - + extractChannel1->SetExtractionRegion(region1); - - + + // We need to find the corresponding region in image 2 FloatImageType::PointType ul1, ur1, ll1, lr1, p1, p2, p3, p4; itk::ContinuousIndex<double,2> i1, i2, i3, i4, i_min, i_max; @@ -418,7 +418,7 @@ private: p2 = rsTransform->TransformPoint(ur1); p3 = rsTransform->TransformPoint(lr1); p4 = rsTransform->TransformPoint(ll1); - + image2->TransformPhysicalPointToContinuousIndex(p1,i1); image2->TransformPhysicalPointToContinuousIndex(p2,i2); image2->TransformPhysicalPointToContinuousIndex(p3,i3); @@ -466,16 +466,16 @@ private: // Create the datasource (for matches export) otb::ogr::Layer layer(NULL, false); otb::ogr::DataSource::Pointer ogrDS; - + ogrDS = otb::ogr::DataSource::New(GetParameterString("outvector"), otb::ogr::DataSource::Modes::Overwrite); std::string projref = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"; OGRSpatialReference oSRS(projref.c_str()); - + // and create the layer layer = ogrDS->CreateLayer("matches", &oSRS, wkbMultiLineString); OGRFeatureDefn & defn = layer.GetLayerDefn(); ogr::Feature feature(defn); - + feature.SetGeometry(&mls); layer.CreateFeature(feature); } diff --git a/Applications/FeatureExtraction/otbRadiometricIndices.cxx b/Applications/FeatureExtraction/otbRadiometricIndices.cxx index 44ca51a603..a046fcbf0b 100644 --- a/Applications/FeatureExtraction/otbRadiometricIndices.cxx +++ b/Applications/FeatureExtraction/otbRadiometricIndices.cxx @@ -138,7 +138,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("otbVegetationIndicesFunctor, otbWaterIndicesFunctor and otbSoilIndicesFunctor classes"); - + AddDocTag("Radiometric Indices"); AddDocTag(Tags::FeatureExtraction); @@ -152,7 +152,7 @@ private: AddParameter(ParameterType_Group, "channels", "Channels selection"); SetParameterDescription("channels", "Channels selection"); - + AddParameter(ParameterType_Int, "channels.blue", "Blue Channel"); SetParameterDescription("channels.blue", "Blue channel index"); SetDefaultParameterInt("channels.blue", 1); @@ -204,7 +204,7 @@ private: SetDocExampleParameterValue("out", "RadiometricIndicesImage.tif"); m_Map.clear(); - + // Add Available choices indiceSpec s_NDVI; s_NDVI.key = "list.ndvi"; @@ -453,7 +453,7 @@ private: m_ImageList->PushBack( l_##type##Filter->GetOutput() ); \ otbAppLogINFO(<< m_Map[GetSelectedItems("list")[idx]].item << " added.");\ } - + #define otbRadiometricVegetationIndicesMacro( type ) \ { \ type##FilterType::Pointer l_##type##Filter = type##FilterType::New(); \ @@ -586,7 +586,7 @@ private: } } - + FilterListType::Pointer m_FilterList; ImageListType::Pointer m_ImageList; ImageListToVectorImageFilterType::Pointer m_Concatener; diff --git a/Applications/Fusion/otbPansharpening.cxx b/Applications/Fusion/otbPansharpening.cxx index edc144e40f..b994acfa56 100644 --- a/Applications/Fusion/otbPansharpening.cxx +++ b/Applications/Fusion/otbPansharpening.cxx @@ -101,12 +101,12 @@ private: AddChoice("method.lmvm", "LMVM"); SetParameterDescription("method.lmvm", "Local Mean and Variance Matching (LMVM) Pan sharpening."); - + AddParameter(ParameterType_Int, "method.lmvm.radiusx", "X radius" ); SetParameterDescription("method.lmvm.radiusx","Set the x radius of the sliding window." ); SetMinimumParameterIntValue("method.lmvm.radiusx", 1); SetDefaultParameterInt("method.lmvm.radiusx", 3); - + AddParameter(ParameterType_Int, "method.lmvm.radiusy", "Y radius"); SetParameterDescription("method.lmvm.radiusy", "Set the y radius of the sliding window."); SetMinimumParameterIntValue("method.lmvm.radiusy", 1); @@ -119,12 +119,12 @@ private: SetParameterDescription("method.bayes.lambda", "Set the weighting value."); SetMinimumParameterFloatValue("method.bayes.lambda", 0); SetDefaultParameterFloat("method.bayes.lambda", 0.9999); - + AddParameter(ParameterType_Float, "method.bayes.s", "S coefficient"); SetParameterDescription("method.bayes.s", "Set the S coefficient."); SetMinimumParameterFloatValue("method.bayes.s", 1); SetDefaultParameterFloat("method.bayes.s", 1); - + AddRAMParameter(); // Doc example parameter settings diff --git a/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx b/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx index 91ef756af1..ef22ca2368 100644 --- a/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx +++ b/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx @@ -58,7 +58,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Hyperspectral); AddDocTag(Tags::DimensionReduction); diff --git a/Applications/Projections/otbBundleToPerfectSensor.cxx b/Applications/Projections/otbBundleToPerfectSensor.cxx index 1e6813f516..45221e0188 100644 --- a/Applications/Projections/otbBundleToPerfectSensor.cxx +++ b/Applications/Projections/otbBundleToPerfectSensor.cxx @@ -60,7 +60,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Geometry); AddDocTag(Tags::Pansharpening); @@ -79,14 +79,14 @@ private: AddRAMParameter(); MandatoryOff("lms"); - + // Doc example parameter settings SetDocExampleParameterValue("inp", "QB_Toulouse_Ortho_PAN.tif"); SetDocExampleParameterValue("inxs", "QB_Toulouse_Ortho_XS.tif"); SetDocExampleParameterValue("out", "BundleToPerfectSensor.png uchar"); - + } - + void DoUpdateParameters() { // Nothing to do here : all parameters are independent @@ -124,7 +124,7 @@ private: InterpolatorType::Pointer interpolator = InterpolatorType::New(); resampler->SetInterpolator(interpolator); - + // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); @@ -142,7 +142,7 @@ private: defSpacing[0] = defScalarSpacing; defSpacing[1] = defScalarSpacing; - + resampler->SetDisplacementFieldSpacing(defSpacing); } else @@ -152,10 +152,10 @@ private: defSpacing[1]=10*spacing[1]; resampler->SetDisplacementFieldSpacing(defSpacing); } - + FloatVectorImageType::PixelType defaultValue; itk::NumericTraits<FloatVectorImageType::PixelType>::SetLength(defaultValue, xs->GetNumberOfComponentsPerPixel()); - + resampler->SetInput(xs); resampler->SetOutputOrigin(origin); resampler->SetOutputSpacing(spacing); @@ -174,7 +174,7 @@ private: fusionFilter->SetPanInput(panchro); fusionFilter->SetXsInput(resampler->GetOutput()); fusionFilter->UpdateOutputInformation(); - + SetParameterOutputImage("out", fusionFilter->GetOutput()); } diff --git a/Applications/Projections/otbConvertCartoToGeoPoint.cxx b/Applications/Projections/otbConvertCartoToGeoPoint.cxx index 44e5a38899..fcff11957b 100644 --- a/Applications/Projections/otbConvertCartoToGeoPoint.cxx +++ b/Applications/Projections/otbConvertCartoToGeoPoint.cxx @@ -47,7 +47,7 @@ public: itkTypeMacro(ConvertCartoToGeoPoint, otb::Application); typedef otb::GenericRSTransform<> TransformType; - + private: void DoInit() { @@ -60,7 +60,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Coordinates); AddDocTag(Tags::Geometry); @@ -73,7 +73,7 @@ private: // Add the MapProjectionParameters MapProjectionParametersHandler::AddMapProjectionParameters(this, "mapproj"); - + AddParameter(ParameterType_Float, "long", "Output long"); SetParameterDescription("long", "Point longitude coordinates."); SetParameterRole("long", Role_Output); @@ -81,7 +81,7 @@ private: AddParameter(ParameterType_Float, "lat", "Output lat"); SetParameterDescription("lat", "Point latitude coordinates."); SetParameterRole("lat", Role_Output); - + // Doc example parameter settings SetDocExampleParameterValue("carto.x", "367074.625"); SetDocExampleParameterValue("carto.y", "4835740"); diff --git a/Applications/Projections/otbConvertSensorToGeoPoint.cxx b/Applications/Projections/otbConvertSensorToGeoPoint.cxx index a1343b3a64..4b95b36fe0 100644 --- a/Applications/Projections/otbConvertSensorToGeoPoint.cxx +++ b/Applications/Projections/otbConvertSensorToGeoPoint.cxx @@ -58,7 +58,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("ConvertCartoToGeoPoint application, otbObtainUTMZoneFromGeoPoint"); - + AddDocTag(Tags::Geometry); AddParameter(ParameterType_InputImage, "in", "Sensor image"); @@ -76,19 +76,19 @@ private: SetParameterDescription("output.idx", "Output point longitude coordinate."); AddParameter(ParameterType_Float, "output.idy","Output Point Latitude"); SetParameterDescription("output.idy", "Output point latitude coordinate."); - + AddParameter(ParameterType_String,"output.town","Main town near the coordinates computed"); SetParameterDescription("output.town", "Nearest main town of the computed geographic point."); AddParameter(ParameterType_String,"output.country","Country of the image"); SetParameterDescription("output.country", "Country of the input image"); - + // Set the parameter role for the output parameters SetParameterRole("output.idx", Role_Output ); SetParameterRole("output.idy", Role_Output ); - + SetParameterRole("output.town", Role_Output ); SetParameterRole("output.country", Role_Output ); - + // Doc example parameter settings SetDocExampleParameterValue("in","QB_TOULOUSE_MUL_Extract_500_500.tif"); SetDocExampleParameterValue("input.idx","200"); diff --git a/Applications/Projections/otbGenerateRPCSensorModel.cxx b/Applications/Projections/otbGenerateRPCSensorModel.cxx index 0059f05871..d6d6da6dc3 100644 --- a/Applications/Projections/otbGenerateRPCSensorModel.cxx +++ b/Applications/Projections/otbGenerateRPCSensorModel.cxx @@ -50,7 +50,7 @@ public: typedef otb::RPCSolverAdapter::GCPsContainerType TiePointsType; typedef otb::GenericRSTransform<double,3,3> RSTransformType; - + /** Standard macro */ itkNewMacro(Self); itkTypeMacro(GenerateRPCSensorModel, otb::Application); @@ -60,7 +60,7 @@ private: { SetName("GenerateRPCSensorModel"); SetDescription("Generate a RPC sensor model from a list of Ground Control Points."); - + SetDocName("Generate a RPC sensor model"); SetDocLongDescription("This application generates a RPC sensor model from a list of Ground Control Points. At least 20 points are required for estimation wihtout elevation support, and 40 points for estimation with elevation support. Elevation support will be automatically deactivated if an insufficient amount of points is provided. The application can optionnaly output a file containing accuracy statistics for each point, and a vector file containing segments represening points residues. The map projection parameter allows to define a map projection in which the accuracy is evaluated."); @@ -69,7 +69,7 @@ private: SetDocLimitations("None"); SetDocSeeAlso("OrthoRectication,HomologousPointsExtraction,RefineSensorModel"); SetDocAuthors("OTB-Team"); - + AddParameter(ParameterType_OutputFilename,"outgeom","Output geom file"); SetParameterDescription("outgeom","Geom file containing the generated RPC sensor model"); @@ -107,23 +107,23 @@ private: void DoExecute() { OGRMultiLineString mls; - + // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); - + // Parse the input file for ground control points std::ifstream ifs; ifs.open(GetParameterString("inpoints").c_str()); - + TiePointsType tiepoints; - + while(!ifs.eof()) { std::string line; std::getline(ifs,line); - + double x,y,z,lat,lon; - + // Avoid commented lines or too short ones if (!line.empty() && line[0] != '#') { @@ -140,7 +140,7 @@ private: pos = nextpos + 1; nextpos = line.find_first_of("\t", pos); lat = atof(line.substr(pos, nextpos).c_str()); - + z = otb::DEMHandler::Instance()->GetHeightAboveEllipsoid(lon,lat); otbAppLogINFO("Adding tie point x="<<x<<", y="<<y<<", z="<<z<<", lon="<<lon<<", lat="<<lat); @@ -158,7 +158,7 @@ private: } } ifs.close(); - + otbAppLogINFO("Optimization in progress ..."); double rms; @@ -214,7 +214,7 @@ private: double gerror = distance->Evaluate(ref,tmpPoint); double xerror = ref[0]-tmpPoint[0]; double yerror = ref[1]-tmpPoint[1]; - + if(IsParameterEnabled("outstat")) ofs<<ref[0]<<"\t"<<ref[1]<<"\t"<<it->first[2]<<"\t"<<tmpPoint[0]<<"\t"<<tmpPoint[1]<<"\t"<<tmpPoint[2]<<"\t"<<xerror<<"\t"<<yerror<<"\t"<<gerror<<std::endl; @@ -265,16 +265,16 @@ if(IsParameterEnabled("outvector")) // Create the datasource (for matches export) otb::ogr::Layer layer(NULL, false); otb::ogr::DataSource::Pointer ogrDS; - + ogrDS = otb::ogr::DataSource::New(GetParameterString("outvector"), otb::ogr::DataSource::Modes::Overwrite); std::string projref = MapProjectionParametersHandler::GetProjectionRefFromChoice(this, "map"); OGRSpatialReference oSRS(projref.c_str()); - + // and create the layer layer = ogrDS->CreateLayer("matches", &oSRS, wkbMultiLineString); OGRFeatureDefn & defn = layer.GetLayerDefn(); ogr::Feature feature(defn); - + feature.SetGeometry(&mls); layer.CreateFeature(feature); } diff --git a/Applications/Projections/otbGridBasedImageResampling.cxx b/Applications/Projections/otbGridBasedImageResampling.cxx index 936e958278..137069dbcc 100644 --- a/Applications/Projections/otbGridBasedImageResampling.cxx +++ b/Applications/Projections/otbGridBasedImageResampling.cxx @@ -56,7 +56,7 @@ public: typedef itk::VectorCastImageFilter <FloatVectorImageType, DisplacementFieldType> DisplacementFieldCastFilterType; - + typedef otb::StreamingWarpImageFilter <FloatVectorImageType, @@ -121,7 +121,7 @@ private: SetParameterDescription("io.in","The input image to resample"); AddParameter(ParameterType_OutputImage, "io.out", "Output Image"); SetParameterDescription("io.out","The resampled output image"); - + AddParameter(ParameterType_Group,"grid","Resampling grid parameters"); AddParameter(ParameterType_InputImage,"grid.in","Input resampling grid"); SetParameterDescription("grid.in","The resampling grid"); @@ -132,10 +132,10 @@ private: AddChoice("grid.type.loc","Localisation grid: $G(x_out,y_out) = (x_in, y_in)$"); SetParameterDescription("grid.type.loc","A localisation grid contains at each grid position the corresponding position in the input image to resample"); - + AddParameter(ParameterType_Group, "out", "Output Image parameters"); SetParameterDescription("out","Parameters of the output image"); - + AddParameter(ParameterType_Float, "out.ulx", "Upper Left X"); SetParameterDescription("out.ulx","X Coordinate of the upper-left pixel of the output resampled image"); SetDefaultParameterFloat("out.ulx",0); @@ -153,12 +153,12 @@ private: AddParameter(ParameterType_Float, "out.spacingy", "Pixel Size Y"); SetParameterDescription("out.spacingy","Size of each pixel along Y axis"); SetDefaultParameterFloat("out.spacingy",1.); - + AddParameter(ParameterType_Float,"out.default","Default value"); SetParameterDescription("out.default","The default value to give to pixel that falls outside of the input image."); SetDefaultParameterFloat("out.default",0); - + // Interpolators AddParameter(ParameterType_Choice, "interpolator", "Interpolation"); SetParameterDescription("interpolator","This group of parameters allows to define how the input image will be interpolated during resampling."); @@ -171,7 +171,7 @@ private: SetParameterDescription("interpolator.bco.radius","This parameter allows to control the size of the bicubic interpolation filter. If the target pixel size is higher than the input pixel size, increasing this parameter will reduce aliasing artefacts."); SetDefaultParameterInt("interpolator.bco.radius", 2); SetParameterString("interpolator","bco"); - + AddRAMParameter(); // Doc example @@ -192,7 +192,7 @@ void DoExecute() { // Get the input image FloatVectorImageType* inImage = GetParameterImage("io.in"); - + // Get the resampling grid FloatVectorImageType * inGrid = GetParameterImage("grid.in"); @@ -273,7 +273,7 @@ void DoExecute() spacing[0] = GetParameterFloat("out.spacingx"); spacing[1] = GetParameterFloat("out.spacingy"); m_WarpImageFilter->SetOutputSpacing(spacing); - + WarpFilterType::PointType ul; ul[0] = GetParameterFloat("out.ulx"); ul[1] = GetParameterFloat("out.uly"); @@ -288,7 +288,7 @@ void DoExecute() // Output Image SetParameterOutputImage("io.out", m_WarpImageFilter->GetOutput()); - + } WarpFilterType::Pointer m_WarpImageFilter; diff --git a/Applications/Projections/otbImageEnvelope.cxx b/Applications/Projections/otbImageEnvelope.cxx index e6ce73b7bd..26823c2681 100644 --- a/Applications/Projections/otbImageEnvelope.cxx +++ b/Applications/Projections/otbImageEnvelope.cxx @@ -58,12 +58,12 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Geometry); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input image."); - + AddParameter(ParameterType_OutputVectorData, "out", "Output Vector Data"); SetParameterDescription("out", "Vector data file containing the envelope"); @@ -72,14 +72,14 @@ private: SetDefaultParameterInt("sr",0); MandatoryOff("sr"); DisableParameter("sr"); - + // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); - + AddParameter(ParameterType_String, "proj", "Projection"); SetParameterDescription("proj", "Projection to be used to compute the envelope (default is WGS84)"); MandatoryOff("proj"); - + // Doc example parameter settings SetDocExampleParameterValue("in", "QB_TOULOUSE_MUL_Extract_500_500.tif"); SetDocExampleParameterValue("out", "ImageEnvelope.shp"); @@ -93,18 +93,18 @@ private: void DoExecute() { FloatVectorImageType::Pointer input = GetParameterImage("in"); - + m_Envelope = EnvelopeFilterType::New(); m_Envelope->SetInput(input); m_Envelope->SetSamplingRate(GetParameterInt("sr")); - + // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); if (HasValue("proj")) { m_Envelope->SetOutputProjectionRef(GetParameterString("proj")); } - + SetParameterOutputVectorData("out", m_Envelope->GetOutput()); } diff --git a/Applications/Projections/otbObtainUTMZoneFromGeoPoint.cxx b/Applications/Projections/otbObtainUTMZoneFromGeoPoint.cxx index 096ed88717..b78e4f9064 100644 --- a/Applications/Projections/otbObtainUTMZoneFromGeoPoint.cxx +++ b/Applications/Projections/otbObtainUTMZoneFromGeoPoint.cxx @@ -39,7 +39,7 @@ public: itkNewMacro(Self); itkTypeMacro(ObtainUTMZoneFromGeoPoint, otb::Application); - + private: ObtainUTMZoneFromGeoPoint() { @@ -65,32 +65,32 @@ private: AddParameter(ParameterType_Float, "lat", "Latitude"); SetParameterDescription("lat", "Latitude value of desired point."); - + AddParameter(ParameterType_Float, "lon", "Longitude"); SetParameterDescription("lon", "Longitude value of desired point."); - + AddParameter(ParameterType_Int,"utm","UTMZone"); SetParameterDescription("utm","UTM Zone"); MandatoryOff("utm"); SetParameterRole("utm", Role_Output); - + 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); } - + }; } diff --git a/Applications/Projections/otbRigidTransformResample.cxx b/Applications/Projections/otbRigidTransformResample.cxx index 35cf0f46c2..59fc3029d0 100644 --- a/Applications/Projections/otbRigidTransformResample.cxx +++ b/Applications/Projections/otbRigidTransformResample.cxx @@ -277,12 +277,12 @@ private: ResampleFilterType::SizeType recomputedSize; recomputedSize[0] = inputImage->GetLargestPossibleRegion().GetSize()[0] / scale[0]; recomputedSize[1] = inputImage->GetLargestPossibleRegion().GetSize()[1] / scale[1]; - + m_Resampler->SetOutputSize(recomputedSize); - + otbAppLogINFO( << "Output image size : " << recomputedSize ); m_Resampler->SetTransform(transform); - + } break; diff --git a/Applications/Projections/otbSuperimpose.cxx b/Applications/Projections/otbSuperimpose.cxx index 9eb666661b..536b8b4ea3 100644 --- a/Applications/Projections/otbSuperimpose.cxx +++ b/Applications/Projections/otbSuperimpose.cxx @@ -64,7 +64,7 @@ public: double> NNInterpolatorType; typedef otb::BCOInterpolateImageFunction <FloatVectorImageType> BCOInterpolatorType; - + typedef otb::GenericRSResampleImageFilter<FloatVectorImageType, FloatVectorImageType> ResamplerType; @@ -80,7 +80,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Geometry); AddDocTag("Superimposition"); @@ -99,25 +99,25 @@ private: AddParameter(ParameterType_OutputImage, "out", "Output image"); SetParameterDescription("out","Output reprojected image."); - + // Interpolators AddParameter(ParameterType_Choice, "interpolator", "Interpolation"); SetParameterDescription("interpolator","This group of parameters allows to define how the input image will be interpolated during resampling."); - + AddChoice("interpolator.bco", "Bicubic interpolation"); SetParameterDescription("interpolator.bco", "Bicubic interpolation leads to very good image quality but is slow."); - + AddParameter(ParameterType_Radius, "interpolator.bco.radius", "Radius for bicubic interpolation"); SetParameterDescription("interpolator.bco.radius","This parameter allows to control the size of the bicubic interpolation filter. If the target pixel size is higher than the input pixel size, increasing this parameter will reduce aliasing artefacts."); SetDefaultParameterInt("interpolator.bco.radius", 2); - + AddChoice("interpolator.nn", "Nearest Neighbor interpolation"); SetParameterDescription("interpolator.nn","Nearest neighbor interpolation leads to poor image quality, but it is very fast."); - + AddChoice("interpolator.linear", "Linear interpolation"); SetParameterDescription("interpolator.linear","Linear interpolation leads to average image quality but is quite fast"); - - + + AddRAMParameter(); // Doc example parameter settings @@ -131,16 +131,16 @@ private: // Nothing to do here : all parameters are independent } - + void DoExecute() { // Get the inputs FloatVectorImageType* refImage = GetParameterImage("inr"); FloatVectorImageType* movingImage = GetParameterImage("inm"); - + // Resample filter m_Resampler = ResamplerType::New(); - + // Get Interpolator switch ( GetParameterInt("interpolator") ) { @@ -164,11 +164,11 @@ private: } break; } - - + + // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); - + // Set up output image informations FloatVectorImageType::SpacingType spacing = refImage->GetSpacing(); FloatVectorImageType::IndexType start = refImage->GetLargestPossibleRegion().GetIndex(); @@ -183,13 +183,13 @@ private: defSpacing[0] = defScalarSpacing; defSpacing[1] = defScalarSpacing; - + if (spacing[0]<0.0) defSpacing[0] *= -1.0; if (spacing[1]<0.0) defSpacing[1] *= -1.0; - + m_Resampler->SetDisplacementFieldSpacing(defSpacing); } - + FloatVectorImageType::PixelType defaultValue; itk::NumericTraits<FloatVectorImageType::PixelType>::SetLength(defaultValue, movingImage->GetNumberOfComponentsPerPixel()); @@ -203,7 +203,7 @@ private: m_Resampler->SetOutputKeywordList(refImage->GetImageKeywordlist()); m_Resampler->SetOutputProjectionRef(refImage->GetProjectionRef()); m_Resampler->SetEdgePaddingValue(defaultValue); - + // Set the output image SetParameterOutputImage("out", m_Resampler->GetOutput()); } @@ -216,4 +216,4 @@ private: OTB_APPLICATION_EXPORT(otb::Wrapper::Superimpose) - + diff --git a/Applications/Radiometry/otbSarRadiometricCalibration.cxx b/Applications/Radiometry/otbSarRadiometricCalibration.cxx index 2b581297fb..b3068c927a 100644 --- a/Applications/Radiometry/otbSarRadiometricCalibration.cxx +++ b/Applications/Radiometry/otbSarRadiometricCalibration.cxx @@ -54,7 +54,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Calibration); AddDocTag(Tags::SAR); @@ -63,9 +63,9 @@ private: AddParameter(ParameterType_ComplexOutputImage, "out", "Output Image"); SetParameterDescription("out", "Output calibrated complex image"); - + AddRAMParameter(); - + AddParameter(ParameterType_Empty, "noise", "Disable Noise"); SetParameterDescription("noise", "Flag to disable noise"); MandatoryOff("noise"); diff --git a/Applications/Rasterization/otbRasterization.cxx b/Applications/Rasterization/otbRasterization.cxx index ea56494c0a..d8e17aecbe 100644 --- a/Applications/Rasterization/otbRasterization.cxx +++ b/Applications/Rasterization/otbRasterization.cxx @@ -49,7 +49,7 @@ public: typedef UInt8ImageType::SizeType SizeType; typedef UInt8ImageType::SpacingType SpacingType; typedef UInt8ImageType::IndexType IndexType; - + // Misc typedef otb::GenericRSTransform<> RSTransformType; typedef otb::PipelineMemoryPrintCalculator MemoryCalculatorType; @@ -68,72 +68,72 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("For now, support of input dataset with multiple layers having different projection reference system is limited."); - + AddDocTag(Tags::Vector); AddParameter(ParameterType_InputFilename, "in", "Input vector dataset"); SetParameterDescription( "in", "The input vector dataset to be rasterized" ); - + AddParameter(ParameterType_OutputImage, "out", "Ouptut image"); SetParameterDescription( "out", "An output image containing the rasterized vector dataset" ); - + AddParameter(ParameterType_InputImage, "im", "Input reference image"); SetParameterDescription( "im", "A reference image from which to import output grid and projection reference system information." ); MandatoryOff("im"); - + AddParameter(ParameterType_Int, "szx", "Output size x"); SetParameterDescription( "szx", "Output size along x axis (useless if support image is given)" ); MandatoryOff("szx"); SetMinimumParameterIntValue("szx",1); - + AddParameter(ParameterType_Int, "szy", "Output size y"); SetParameterDescription( "szy", "Output size along y axis (useless if support image is given)" ); MandatoryOff("szy"); SetMinimumParameterIntValue("szy",1); - + AddParameter(ParameterType_Int, "epsg", "Output EPSG code"); SetParameterDescription( "epsg", "EPSG code for the output projection reference system (EPSG 4326 for WGS84, 32631 for UTM31N...,useless if support image is given)" ); MandatoryOff("epsg"); - + AddParameter(ParameterType_Float, "orx", "Output Upper-left x"); SetParameterDescription( "orx", "Output upper-left x coordinate (useless if support image is given)" ); MandatoryOff("orx"); - + AddParameter(ParameterType_Float, "ory", "Output Upper-left y"); SetParameterDescription( "ory", "Output upper-left y coordinate (useless if support image is given)" ); MandatoryOff("ory"); - + AddParameter(ParameterType_Float, "spx", "Spacing (GSD) x"); SetParameterDescription( "spx", "Spacing (ground sampling distance) along x axis (useless if support image is given)" ); MandatoryOff("spx"); - + AddParameter(ParameterType_Float, "spy", "Spacing (GSD) y"); SetParameterDescription( "spy", "Spacing (ground sampling distance) along y axis (useless if support image is given)" ); MandatoryOff("spy"); - + AddParameter(ParameterType_Float,"background", "Background value"); SetParameterDescription("background","Default value for pixels not belonging to any geometry"); SetDefaultParameterFloat("background",0.); AddParameter(ParameterType_Choice,"mode","Rasterization mode"); SetParameterDescription("mode","Choice of rasterization modes"); - + AddChoice("mode.binary","Binary mode"); SetParameterDescription("mode.binary","In this mode, pixels within a geometry will hold the user-defined foreground value"); AddParameter(ParameterType_Float,"mode.binary.foreground","Foreground value"); SetParameterDescription("mode.binary.foreground","Value for pixels inside a geometry"); SetDefaultParameterFloat("mode.binary.foreground",255); - + AddChoice("mode.attribute","Attribute burning mode"); SetParameterDescription("mode.attribute","In this mode, pixels within a geometry will hold the value of a user-defined field extracted from this geometry."); AddParameter(ParameterType_String,"mode.attribute.field","The attribute field to burn"); SetParameterDescription("mode.attribute.field","Name of the attribute field to burn"); SetParameterString("mode.attribute.field","DN"); - + AddRAMParameter(); - + SetDocExampleParameterValue("in","qb_RoadExtract_classification.shp"); SetDocExampleParameterValue("out", "rasterImage.tif"); SetDocExampleParameterValue("spx","1."); @@ -144,8 +144,8 @@ private: { // Nothing to do } - - + + void DoExecute() { otb::ogr::DataSource::Pointer ogrDS; @@ -208,7 +208,7 @@ private: SizeType size; PointType origin; SpacingType spacing; - + // reading projection information // two choice : std::string outputProjectionRef; @@ -221,14 +221,14 @@ private: otbAppLogWARNING("A reference image has been given, other parameters " "regarding the output image will be ignored"); } - + referenceImage = GetParameterUInt8Image("im"); outputProjectionRef = referenceImage->GetProjectionRef(); - + size = referenceImage->GetLargestPossibleRegion().GetSize(); - + origin = referenceImage->GetOrigin(); - + spacing = referenceImage->GetSpacing(); } else if (HasValue("spx") && HasValue("spy")) @@ -255,9 +255,9 @@ private: { origin[0] = (spacing[0] > 0 ? ulx : lrx); origin[1] = (spacing[1] > 0 ? uly : lry); - + // Transform to output EPSG - + if(validInputProjRef) { RSTransformType::Pointer rsTransform = RSTransformType::New(); @@ -307,14 +307,14 @@ private: { otbAppLogFATAL("No reference image was given, at least spx and spy parameters must be set."); } - + m_OGRDataSourceRendering = OGRDataSourceToMapFilterType::New(); m_OGRDataSourceRendering->AddOGRDataSource(ogrDS); m_OGRDataSourceRendering->SetOutputSize(size); m_OGRDataSourceRendering->SetOutputOrigin(origin); m_OGRDataSourceRendering->SetOutputSpacing(spacing); m_OGRDataSourceRendering->SetBackgroundValue(GetParameterFloat("background")); - + if(GetParameterString("mode") == "binary") { m_OGRDataSourceRendering->SetBurnAttributeMode(false); @@ -330,7 +330,7 @@ private: { m_OGRDataSourceRendering->SetOutputProjectionRef(outputProjectionRef); } - + otbAppLogINFO("Output projection reference system is: "<<outputProjectionRef); otbAppLogINFO("Output origin: "<<origin); @@ -338,11 +338,11 @@ private: otbAppLogINFO("Output spacing: "<<spacing); SetParameterOutputImage<FloatImageType>("out", m_OGRDataSourceRendering->GetOutput()); - + } - + OGRDataSourceToMapFilterType::Pointer m_OGRDataSourceRendering; - + }; } diff --git a/Applications/Segmentation/otbConnectedComponentSegmentation.cxx b/Applications/Segmentation/otbConnectedComponentSegmentation.cxx index 5848c8b983..83674d5b5e 100644 --- a/Applications/Segmentation/otbConnectedComponentSegmentation.cxx +++ b/Applications/Segmentation/otbConnectedComponentSegmentation.cxx @@ -53,16 +53,16 @@ public: typedef otb::VectorImage<InputPixelType, Dimension> InputVectorImageType; typedef otb::Image<unsigned int, Dimension> LabelImageType; typedef otb::Image<unsigned int, Dimension> MaskImageType; - + typedef otb::VectorData<double, Dimension> VectorDataType; typedef VectorDataType::Pointer VectorDataPointerType; - + typedef otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter < InputVectorImageType, LabelImageType, MaskImageType, VectorDataType > SegmentationFilterType; - + typedef otb::VectorDataProjectionFilter <VectorDataType, VectorDataType> VectorDataProjectionFilterType; @@ -76,22 +76,22 @@ private: SetDocLimitations("Due to the tiling scheme in case of large images, some segments can be arbitrarily split across multiple tiles."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Analysis); AddDocTag(Tags::Segmentation); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The image to segment."); - + AddParameter(ParameterType_OutputVectorData, "out", "Output Shape"); SetParameterDescription("out", "The segmentation shape."); - - + + AddParameter(ParameterType_String, "mask", "Mask expression"); SetParameterDescription("mask", "Mask mathematical expression (only if support image is given)"); MandatoryOff("mask"); DisableParameter("mask"); - + AddParameter(ParameterType_String, "expr", "Connected Component Expression"); SetParameterDescription("expr", "Formula used for connected component segmentation"); @@ -100,12 +100,12 @@ private: SetDefaultParameterInt("minsize", 2); SetMinimumParameterIntValue("minsize", 1); MandatoryOff("minsize"); - + AddParameter(ParameterType_String, "obia", "OBIA Expression"); SetParameterDescription("obia", "OBIA mathematical expression"); MandatoryOff("obia"); DisableParameter("obia"); - + // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); @@ -117,32 +117,32 @@ private: SetDocExampleParameterValue("obia", "\"SHAPE_Elongation>8\""); SetDocExampleParameterValue("out", "ConnectedComponentSegmentation.shp"); } - + void DoUpdateParameters() { // Nothing to do here for the parameters : all are independent } - + void DoExecute() { InputVectorImageType::Pointer inputImage = GetParameterImage("in"); - + m_Connected = SegmentationFilterType::FilterType::New(); m_Connected->GetFilter()->SetInput(inputImage); - + if (IsParameterEnabled("mask") && HasValue("mask")) m_Connected->GetFilter()->SetMaskExpression(GetParameterString("mask")); - + m_Connected->GetFilter()->SetConnectedComponentExpression(GetParameterString("expr")); - + m_Connected->GetFilter()->SetMinimumObjectSize(GetParameterInt("minsize")); - + if (IsParameterEnabled("obia") && HasValue("obia")) m_Connected->GetFilter()->SetOBIAExpression(GetParameterString("obia")); - + AddProcess(m_Connected,"Computing segmentation"); m_Connected->Update(); - + /* * Reprojection of the output VectorData * @@ -151,16 +151,16 @@ private: * * We need to reproject in WGS84 if the input image is in sensor model geometry */ - + std::string projRef = inputImage->GetProjectionRef(); ImageKeywordlist kwl = inputImage->GetImageKeywordlist(); - + VectorDataType::Pointer projectedVD = m_Connected->GetFilter()->GetOutputVectorData(); - + if ( projRef.empty() && kwl.GetSize() > 0 ) { // image is in sensor model geometry - + // Reproject VectorData in image projection m_Vproj = VectorDataProjectionFilterType::New(); m_Vproj->SetInput(m_Connected->GetFilter()->GetOutputVectorData()); @@ -171,10 +171,10 @@ private: // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); m_Vproj->Update(); - + projectedVD = m_Vproj->GetOutput(); } - + SetParameterOutputVectorData("out", projectedVD); } diff --git a/Applications/Segmentation/otbHooverCompareSegmentation.cxx b/Applications/Segmentation/otbHooverCompareSegmentation.cxx index 8672055b95..5b16859411 100644 --- a/Applications/Segmentation/otbHooverCompareSegmentation.cxx +++ b/Applications/Segmentation/otbHooverCompareSegmentation.cxx @@ -41,7 +41,7 @@ public: virtual ~HooverColorMapping() {} typedef std::vector<TOutput> ColorListType; - + unsigned int GetOutputSize() { return 3; @@ -50,7 +50,7 @@ public: { m_ScoreColors.push_back(color); } - + void SetBackground(const TOutput& bg) { m_Background = bg; @@ -60,7 +60,7 @@ public: { TOutput out; out.SetSize(3); - + typename TInput::ValueType max = 0.0; unsigned int index=0; for (unsigned int i=0; i<m_ScoreColors.size(); i++) @@ -106,7 +106,7 @@ public: itkNewMacro(Self); itkTypeMacro(HooverCompareSegmentation, otb::Application); - + typedef otb::AttributesMapLabelObject<unsigned int, 2, float> LabelObjectType; typedef itk::LabelMap<LabelObjectType> LabelMapType; typedef otb::HooverMatrixFilter<LabelMapType> HooverMatrixFilterType; @@ -118,7 +118,7 @@ public: <ImageType, LabelMapType> ImageToLabelMapFilterType; typedef otb::ImageFileReader<ImageType> ImageReaderType; typedef HooverMatrixFilterType::MatrixType MatrixType; - + typedef otb::HooverInstanceFilter<LabelMapType> InstanceFilterType; typedef otb::LabelMapToAttributeImageFilter <LabelMapType, FloatVectorImageType> AttributeImageFilterType; @@ -153,50 +153,50 @@ private: AddParameter(ParameterType_InputImage, "ingt", "Input ground truth"); SetParameterDescription( "ingt", "A partial ground truth segmentation image." ); - + AddParameter(ParameterType_InputImage, "inms", "Input machine segmentation"); SetParameterDescription( "inms", "A machine segmentation image." ); - + AddParameter(ParameterType_Int, "bg", "Background label"); SetParameterDescription("bg", "Label value of the background in the input segmentations"); SetDefaultParameterInt("bg", 0); - + AddParameter(ParameterType_Float, "th", "Overlapping threshold"); SetParameterDescription("th", "Overlapping threshold used to find Hoover instances."); SetDefaultParameterFloat("th", 0.75); - + AddParameter(ParameterType_OutputImage, "outgt", "Colored ground truth output"); SetParameterDescription( "outgt", "The colored ground truth output image." ); MandatoryOff("outgt"); - + AddParameter(ParameterType_OutputImage, "outms", "Colored machine segmentation output"); SetParameterDescription( "outms", "The colored machine segmentation output image." ); MandatoryOff("outms"); - + // TODO : add color settings ? - + AddParameter(ParameterType_Float, "rc", "Correct detection score"); SetParameterDescription("rc", "Overall score for correct detection (RC)"); SetParameterRole("rc", Role_Output); - + AddParameter(ParameterType_Float, "rf", "Over-segmentation score"); SetParameterDescription("rf", "Overall score for over segmentation (RF)"); SetParameterRole("rf", Role_Output); - + AddParameter(ParameterType_Float, "ra", "Under-segmentation score"); SetParameterDescription("ra", "Overall score for under segmentation (RA)"); SetParameterRole("ra", Role_Output); - + AddParameter(ParameterType_Float, "rm", "Missed detection score"); SetParameterDescription("rm", "Overall score for missed detection (RM)"); SetParameterRole("rm", Role_Output); - + // Doc example parameter settings SetDocExampleParameterValue("ingt", "maur_GT.tif"); SetDocExampleParameterValue("inms", "maur_labelled.tif"); SetDocExampleParameterValue("outgt", "maur_colored_GT.tif uint8"); } - + void DoUpdateParameters() { // Nothing to do here : all parameters are independent @@ -206,48 +206,48 @@ private: { UInt32ImageType::Pointer inputGT = GetParameterUInt32Image("ingt"); UInt32ImageType::Pointer inputMS = GetParameterUInt32Image("inms"); - + m_GTFilter = ImageToLabelMapFilterType::New(); m_GTFilter->SetInput(inputGT); m_GTFilter->SetBackgroundValue( GetParameterInt("bg") ); - + m_MSFilter = ImageToLabelMapFilterType::New(); m_MSFilter->SetInput(inputMS); m_MSFilter->SetBackgroundValue( GetParameterInt("bg") ); - + m_HooverFilter = HooverMatrixFilterType::New(); m_HooverFilter->SetGroundTruthLabelMap(m_GTFilter->GetOutput()); m_HooverFilter->SetMachineSegmentationLabelMap(m_MSFilter->GetOutput()); - + m_HooverFilter->Update(); - + m_InstanceFilter = InstanceFilterType::New(); m_InstanceFilter->SetGroundTruthLabelMap(m_GTFilter->GetOutput()); m_InstanceFilter->SetMachineSegmentationLabelMap(m_MSFilter->GetOutput()); m_InstanceFilter->SetThreshold( GetParameterFloat("th") ); m_InstanceFilter->SetHooverMatrix( m_HooverFilter->GetHooverConfusionMatrix() ); m_InstanceFilter->SetUseExtendedAttributes(false); - + m_AttributeImageGT = AttributeImageFilterType::New(); m_AttributeImageGT->SetInput(m_InstanceFilter->GetOutputGroundTruthLabelMap()); m_AttributeImageGT->SetAttributeForNthChannel(0, InstanceFilterType::GetNameFromAttribute(InstanceFilterType::ATTRIBUTE_RC)); m_AttributeImageGT->SetAttributeForNthChannel(1, InstanceFilterType::GetNameFromAttribute(InstanceFilterType::ATTRIBUTE_RF)); m_AttributeImageGT->SetAttributeForNthChannel(2, InstanceFilterType::GetNameFromAttribute(InstanceFilterType::ATTRIBUTE_RA)); m_AttributeImageGT->SetAttributeForNthChannel(3, InstanceFilterType::GetNameFromAttribute(InstanceFilterType::ATTRIBUTE_RM)); - + m_AttributeImageMS = AttributeImageFilterType::New(); m_AttributeImageMS->SetInput(m_InstanceFilter->GetOutputMachineSegmentationLabelMap()); m_AttributeImageMS->SetAttributeForNthChannel(0, InstanceFilterType::GetNameFromAttribute(InstanceFilterType::ATTRIBUTE_RC)); m_AttributeImageMS->SetAttributeForNthChannel(1, InstanceFilterType::GetNameFromAttribute(InstanceFilterType::ATTRIBUTE_RF)); m_AttributeImageMS->SetAttributeForNthChannel(2, InstanceFilterType::GetNameFromAttribute(InstanceFilterType::ATTRIBUTE_RA)); //m_AttributeImageMS->SetAttributeForNthChannel(3, InstanceFilterType::GetNameFromAttribute(InstanceFilterType::ATTRIBUTE_RN); - + m_GTColorFilter = HooverColorFilterType::New(); m_GTColorFilter->SetInput(m_AttributeImageGT->GetOutput()); - + m_MSColorFilter = HooverColorFilterType::New(); m_MSColorFilter->SetInput(m_AttributeImageMS->GetOutput()); - + Int16PixelType colorPixel; colorPixel.SetSize(3); // Background : white @@ -279,34 +279,34 @@ private: colorPixel[1] = 0; colorPixel[2] = 0; m_GTColorFilter->GetFunctor().AddColor(colorPixel); - + if (HasValue("outgt")) { SetParameterOutputImage("outgt", m_GTColorFilter->GetOutput()); } - + if (HasValue("outms")) { SetParameterOutputImage("outms", m_MSColorFilter->GetOutput()); } - + m_InstanceFilter->Update(); - + SetParameterFloat("rc", m_InstanceFilter->GetMeanRC()); SetParameterFloat("rf", m_InstanceFilter->GetMeanRF()); SetParameterFloat("ra", m_InstanceFilter->GetMeanRA()); SetParameterFloat("rm", m_InstanceFilter->GetMeanRM()); } - + ImageToLabelMapFilterType::Pointer m_GTFilter; ImageToLabelMapFilterType::Pointer m_MSFilter; - + HooverMatrixFilterType::Pointer m_HooverFilter; InstanceFilterType::Pointer m_InstanceFilter; - + AttributeImageFilterType::Pointer m_AttributeImageGT; AttributeImageFilterType::Pointer m_AttributeImageMS; - + HooverColorFilterType::Pointer m_GTColorFilter; HooverColorFilterType::Pointer m_MSColorFilter; }; diff --git a/Applications/Segmentation/otbLSMSSegmentation.cxx b/Applications/Segmentation/otbLSMSSegmentation.cxx index fd67ff3bd2..a7c27e1551 100644 --- a/Applications/Segmentation/otbLSMSSegmentation.cxx +++ b/Applications/Segmentation/otbLSMSSegmentation.cxx @@ -75,11 +75,11 @@ public: typedef itk::ChangeLabelImageFilter<LabelImageType,LabelImageType> ChangeLabelImageFilterType; typedef otb::ImportGeoInformationImageFilter<LabelImageType,ImageType> ImportGeoInformationImageFilterType; typedef itk::ImageRegionConstIterator<LabelImageType> LabelImageIterator; - + typedef otb::ConcatenateVectorImageFilter <ImageType,ImageType,ImageType> ConcatenateType; LSMSSegmentation(): m_FinalReader(),m_ImportGeoInformationFilter(),m_FilesToRemoveAfterExecute(),m_TmpDirCleanup(false){} - + virtual ~LSMSSegmentation(){} private: @@ -95,12 +95,12 @@ private: std::stringstream tileOut; tileOut<<tilesname<<"_"<<row<<"_"<<column<<"_"<<label<<".tif"; - + std::vector<std::string> joins; if(IsParameterEnabled("tmpdir")) { std::string tmpdir = GetParameterString("tmpdir"); - + if(tmpdir.size() > 1 && tmpdir[tmpdir.size()-1] != '/') { tmpdir.append("/"); @@ -108,16 +108,16 @@ private: joins.push_back(tmpdir); } joins.push_back(tileOut.str()); - + std::string currentFile = itksys::SystemTools::JoinPath(joins); return currentFile; } - + std::string WriteTile(LabelImageType::Pointer img, unsigned int row, unsigned int column, std::string label) { std::string currentFile = CreateFileName(row,column,label); - + LabelImageWriterType::Pointer imageWriter = LabelImageWriterType::New(); imageWriter->SetInput(img); imageWriter->SetFileName(currentFile); @@ -158,15 +158,15 @@ private: ImageType::Pointer imageIn = GetParameterImage("in"); std::string outfname = GetParameterString("out"); - + std::stringstream vrtfOut; vrtfOut<<itksys::SystemTools::GetFilenameWithoutExtension(outfname.c_str())<<".vrt"; - + std::vector<std::string> joins; if(IsParameterEnabled("tmpdir")) { std::string tmpdir = GetParameterString("tmpdir"); - + if(tmpdir.size() > 1 && tmpdir[tmpdir.size()-1] != '/') { tmpdir.append("/"); @@ -174,7 +174,7 @@ private: joins.push_back(tmpdir); } joins.push_back(vrtfOut.str()); - + std::string vrtfname = itksys::SystemTools::JoinPath(joins); otbAppLogINFO(<<"Creating temporary vrt file: "<<vrtfname); @@ -243,7 +243,7 @@ private: SetDefaultParameterInt("minsize", 0); SetMinimumParameterIntValue("minsize", 0); MandatoryOff("minsize"); - + AddParameter(ParameterType_Int, "tilesizex", "Size of tiles in pixel (X-axis)"); SetParameterDescription("tilesizex", "Size of tiles along the X-axis."); SetDefaultParameterInt("tilesizex", 500); @@ -273,7 +273,7 @@ private: SetDocExampleParameterValue("minsize","0"); SetDocExampleParameterValue("tilesizex","256"); SetDocExampleParameterValue("tilesizey","256"); - + } void DoUpdateParameters() @@ -285,12 +285,12 @@ private: m_FilesToRemoveAfterExecute.clear(); clock_t tic = clock(); - + const float ranger = GetParameterFloat("ranger"); const float spatialr = GetParameterFloat("spatialr"); - + unsigned int minRegionSize = GetParameterInt("minsize"); - + unsigned long sizeTilesX = GetParameterInt("tilesizex"); unsigned long sizeTilesY = GetParameterInt("tilesizey"); @@ -312,7 +312,7 @@ private: // 3-Minimal size region suppression ImageType::Pointer spatialIn; - + if(HasValue("inpos")) { spatialIn = GetParameterImage("inpos"); @@ -332,11 +332,11 @@ private: otbAppLogINFO(<<"Number of tiles: "<<nbTilesX<<" x "<<nbTilesY); unsigned long regionCount = 0; - + //Segmentation by the connected component per tile and label //shifting otbAppLogINFO(<<"Tile shifting ..."); - + for(unsigned int row = 0; row < nbTilesY; ++row) for(unsigned int column = 0; column < nbTilesX; ++column) { @@ -345,7 +345,7 @@ private: unsigned long startY = row*sizeTilesY; unsigned long sizeX = vcl_min(sizeTilesX+1,sizeImageX-startX+1); unsigned long sizeY = vcl_min(sizeTilesY+1,sizeImageY-startY+1); - + //Tiles extraction of : //- the input image (filtering image) MultiChannelExtractROIFilterType::Pointer extractROIFilter = MultiChannelExtractROIFilterType::New(); @@ -369,19 +369,19 @@ private: extractROIFilter2->SetSizeX(sizeX); extractROIFilter2->SetSizeY(sizeY); extractROIFilter2->Update(); - + //Concatenation of the two input images concat->SetInput1(extractROIFilter->GetOutput()); concat->SetInput2(extractROIFilter2->GetOutput()); concat->Update(); - + ccFilter->SetInput(concat->GetOutput()); } else { ccFilter->SetInput(extractROIFilter->GetOutput()); } - + //Expression 1 : radiometric distance < ranger std::stringstream expr; expr<<"sqrt((p1b1-p2b1)*(p1b1-p2b1)"; @@ -395,14 +395,14 @@ private: expr<<" and sqrt((p1b"<<nbComp+1<<"-p2b"<<nbComp+1<<")*(p1b"<<nbComp+1<<"-p2b"<<nbComp+1<<")+"; expr<<"(p1b"<<nbComp+2<<"-p2b"<<nbComp+2<<")*(p1b"<<nbComp+2<<"-p2b"<<nbComp+2<<"))"<<"<"<<spatialr; } - + //Segmentation 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"); @@ -417,7 +417,7 @@ private: std::string filename = WriteTile(labelBandMath->GetOutput(),row,column,"SEG"); } - + // Step 2: create the look-up table for all overlaps otbAppLogINFO(<<"LUT creation ..."); @@ -426,7 +426,7 @@ private: LUT.resize(regionCount+1); for(LabelImagePixelType curLabel = 1; curLabel <= regionCount; ++curLabel) LUT[curLabel] = curLabel; - + for(unsigned int row = 0; row < nbTilesY; row++) { for(unsigned int column = 0; column < nbTilesX; column++) @@ -435,7 +435,7 @@ private: unsigned long startY = row*sizeTilesY; unsigned long sizeX = vcl_min(sizeTilesX+1,sizeImageX-startX+1); unsigned long sizeY = vcl_min(sizeTilesY+1,sizeImageY-startY+1); - + std::string tileIn = CreateFileName(row,column,"SEG"); // Read current tile @@ -467,7 +467,7 @@ private: curCanLabel = LUT[curCanLabel]; } LabelImagePixelType adjCanLabel = tileUpReader->GetOutput()->GetPixel(pixelIndexUp); - + while(LUT[adjCanLabel] != adjCanLabel) { adjCanLabel = LUT[adjCanLabel]; @@ -523,7 +523,7 @@ private: } } } - + // Reduce LUT to canonical labels for(LabelImagePixelType label = 1; label < regionCount+1; ++label) { @@ -535,7 +535,7 @@ private: LUT[label] = can; } otbAppLogINFO(<<"LUT size: "<<LUT.size()<<" segments"); - + // These variables will be used to estimate the size of each // region on the flow std::vector<unsigned long> sizePerRegion(regionCount+1,0); @@ -562,11 +562,11 @@ private: labelImage->SetStartY(0); labelImage->SetSizeX(sizeX); labelImage->SetSizeY(sizeY); - + // Relabel tile according to look-up table ChangeLabelImageFilterType::Pointer changeLabel = ChangeLabelImageFilterType::New(); changeLabel->SetInput(labelImage->GetOutput()); - + // Fill LUT for(LabelImagePixelType label = 1; label<regionCount+1; ++label) { @@ -623,7 +623,7 @@ private: // Clear sizePerRegion, we do not need it anymore sizePerRegion.clear(); - + for(unsigned int column = 0; column < nbTilesX; ++column) { for(unsigned int row = 0; row < nbTilesY; ++row) @@ -642,7 +642,7 @@ private: changeLabel->SetChange(label,newLabels[label]); } } - + // Write the relabeled tile std::string tmpfile = WriteTile(changeLabel->GetOutput(),row,column,"FINAL"); m_FilesToRemoveAfterExecute.push_back(tmpfile); @@ -655,7 +655,7 @@ private: // Clear newLabels, we do not need it anymore newLabels.clear(); - + // Here we write a temporary vrt file that will be used to // stitch together all the tiles std::string vrtfile = WriteVRTFile(nbTilesX,nbTilesY,sizeTilesX,sizeTilesY,sizeImageX,sizeImageY); @@ -663,7 +663,7 @@ private: m_FilesToRemoveAfterExecute.push_back(vrtfile); clock_t toc = clock(); - + otbAppLogINFO(<<"Elapsed time: "<<(double)(toc - tic) / CLOCKS_PER_SEC<<" seconds"); // Final writing @@ -681,7 +681,7 @@ private: { // Release input files m_FinalReader = 0; - + if(IsParameterEnabled("cleanup")) { otbAppLogINFO(<<"Final clean-up ..."); diff --git a/Applications/Segmentation/otbLSMSSmallRegionsMerging.cxx b/Applications/Segmentation/otbLSMSSmallRegionsMerging.cxx index c0650270b4..7609413f07 100644 --- a/Applications/Segmentation/otbLSMSSmallRegionsMerging.cxx +++ b/Applications/Segmentation/otbLSMSSmallRegionsMerging.cxx @@ -51,18 +51,18 @@ public: typedef ImageType::InternalPixelType ImagePixelType; typedef UInt32ImageType LabelImageType; typedef LabelImageType::InternalPixelType LabelImagePixelType; - + typedef otb::MultiChannelExtractROI <ImagePixelType,ImagePixelType > MultiChannelExtractROIFilterType; typedef otb::ExtractROI<LabelImagePixelType,LabelImagePixelType> ExtractROIFilterType; - + typedef otb::StreamingStatisticsImageFilter<LabelImageType> StatisticsImageFilterType; - + typedef itk::ImageRegionConstIterator<LabelImageType> LabelImageIterator; typedef itk::ImageRegionConstIterator<ImageType> ImageIterator; - + typedef itk::ChangeLabelImageFilter<LabelImageType,LabelImageType> ChangeLabelImageFilterType; typedef otb::TileImageFilter<LabelImageType> TileImageFilterType; - + itkNewMacro(Self); itkTypeMacro(Merging, otb::Application); @@ -86,7 +86,7 @@ private: SetParameterDescription( "in", "The input image." ); AddParameter(ParameterType_InputImage, "inseg", "Segmented image"); SetParameterDescription( "inseg", " The segmented image input. Segmented image input is the segmentation of the input image." ); - + AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription( "out", "The output image. The output image is the input image where the minimal regions have been merged." ); @@ -123,9 +123,9 @@ private: void DoExecute() { clock_t tic = clock(); - + unsigned int minSize = GetParameterInt("minsize"); - + unsigned long sizeTilesX = GetParameterInt("tilesizex"); unsigned long sizeTilesY = GetParameterInt("tilesizey"); @@ -156,7 +156,7 @@ private: unsigned int nbTilesX = sizeImageX/sizeTilesX + (sizeImageX%sizeTilesX > 0 ? 1 : 0); unsigned int nbTilesY = sizeImageY/sizeTilesY + (sizeImageY%sizeTilesY > 0 ? 1 : 0); - + otbAppLogINFO(<<"Number of tiles: "<<nbTilesX<<" x "<<nbTilesY); //Sums calculation per label @@ -213,7 +213,7 @@ private: //Minimal size region suppression otbAppLogINFO(<<"Building LUT for small regions merging ..."); - + for (unsigned int size=1; size<minSize; size++) { // LUTtmp creation in order to modify the LUT only at the end of the pass @@ -231,11 +231,11 @@ private: { std::set<int> minLabel, edgeLabel, labelMerged; std::map<int,std::set<int> > adjMap; - + unsigned long startX = column*sizeTilesX, startY = row*sizeTilesY; unsigned long sizeX = vcl_min(sizeTilesX+size+1,sizeImageX-startX), sizeY = vcl_min(sizeTilesY+size+1,sizeImageY-startY); - + ExtractROIFilterType::Pointer labelImageROI = ExtractROIFilterType::New(); labelImageROI->SetInput(labelIn); labelImageROI->SetStartX(startX); @@ -243,15 +243,15 @@ private: labelImageROI->SetSizeX(sizeX); labelImageROI->SetSizeY(sizeY); labelImageROI->Update(); - + LabelImageType::IndexType pixelIndex; - + //"Adjacency map" creation for the region with nbPixels=="size" for(pixelIndex[0]=0; pixelIndex[0]<static_cast<long>(sizeX); ++pixelIndex[0]) for(pixelIndex[1]=0; pixelIndex[1]<static_cast<long>(sizeY); ++pixelIndex[1]) { LabelImagePixelType curLabel = labelImageROI->GetOutput()->GetPixel(pixelIndex); - + if(labelMerged.count(LUT[curLabel])) { edgeLabel.insert(LUT[curLabel]); @@ -264,7 +264,7 @@ private: { edgeLabel.insert(LUT[curLabel]); } - + if(pixelIndex[0]==static_cast<long>(sizeX)-1) { if(startX!=(nbTilesX-1)*sizeTilesX) edgeLabel.insert(LUT[curLabel]); @@ -274,7 +274,7 @@ private: ++pixelIndex[0]; LabelImagePixelType adjLabelX = labelImageROI->GetOutput()->GetPixel(pixelIndex); --pixelIndex[0]; - + if(LUT[adjLabelX]!=LUT[curLabel]) { if((nbPixels[LUT[curLabel]]>0)&&(nbPixels[LUT[curLabel]]==size)) @@ -312,7 +312,7 @@ private: } } } - + //Searching the "nearest" region for(std::set<int>::iterator itMinLabel=minLabel.begin(); itMinLabel!=minLabel.end(); ++itMinLabel) { @@ -343,7 +343,7 @@ private: } } } - + //Fusion of the two regions if(adjLabel!=curLabel) { @@ -368,7 +368,7 @@ private: } } } - + for(LabelImagePixelType label = 1; label < regionCount+1; ++label) { LabelImagePixelType can = label; @@ -380,7 +380,7 @@ private: } } } - + for(LabelImagePixelType label = 1; label < regionCount+1; ++label) { LUT[label]=LUTtmp[label]; diff --git a/Applications/Segmentation/otbLSMSVectorization.cxx b/Applications/Segmentation/otbLSMSVectorization.cxx index 4e0fb08765..e8f04af98c 100644 --- a/Applications/Segmentation/otbLSMSVectorization.cxx +++ b/Applications/Segmentation/otbLSMSVectorization.cxx @@ -45,19 +45,19 @@ public: typedef ImageType::InternalPixelType ImagePixelType; typedef UInt32ImageType LabelImageType; typedef LabelImageType::InternalPixelType LabelImagePixelType; - + typedef otb::ImageFileReader<LabelImageType> LabelImageReaderType; - + typedef otb::MultiChannelExtractROI <ImagePixelType,ImagePixelType > MultiChannelExtractROIFilterType; typedef otb::ExtractROI<LabelImagePixelType,LabelImagePixelType> ExtractROIFilterType; - + typedef otb::StreamingStatisticsImageFilter<LabelImageType> StatisticsImageFilterType; - + typedef itk::ImageRegionConstIterator<LabelImageType> LabelImageIterator; typedef itk::ImageRegionConstIterator<ImageType> ImageIterator; - + typedef otb::LabelImageToOGRDataSourceFilter<LabelImageType> LabelImageToOGRDataSourceFilterType; - + itkNewMacro(Self); @@ -112,11 +112,11 @@ private: clock_t tic = clock(); const char * shapefile = GetParameterString("out").c_str(); - + unsigned long sizeTilesX = GetParameterInt("tilesizex"); unsigned long sizeTilesY = GetParameterInt("tilesizey"); - + LabelImageType::Pointer labelIn = GetParameterUInt32Image("inseg"); labelIn->UpdateOutputInformation(); @@ -125,7 +125,7 @@ private: unsigned int nbTilesX = sizeImageX/sizeTilesX + (sizeImageX%sizeTilesX > 0 ? 1 : 0); unsigned int nbTilesY = sizeImageY/sizeTilesY + (sizeImageY%sizeTilesY > 0 ? 1 : 0); - + otbAppLogINFO(<<"Number of tiles: "<<nbTilesX<<" x "<<nbTilesY); StatisticsImageFilterType::Pointer stats = StatisticsImageFilterType::New(); @@ -153,7 +153,7 @@ private: std::vector<ImageType::PixelType>sum(regionCount+1,defaultValue); std::vector<ImageType::PixelType>sum2(regionCount+1,defaultValue); - + otb::ogr::DataSource::Pointer ogrDS; otb::ogr::Layer layer(NULL, false); @@ -170,7 +170,7 @@ private: layer.CreateField(labelField, true); OGRFieldDefn nbPixelsField("nbPixels", OFTInteger); layer.CreateField(nbPixelsField, true); - + for(unsigned int comp = 0; comp<numberOfComponentsPerPixel; ++comp){ std::ostringstream fieldoss; fieldoss<<"meanB"<<comp; @@ -195,7 +195,7 @@ private: unsigned long startY = row*sizeTilesY; unsigned long sizeX = vcl_min(sizeTilesX,sizeImageX-startX); unsigned long sizeY = vcl_min(sizeTilesY,sizeImageY-startY); - + //Tiles extraction of the input image MultiChannelExtractROIFilterType::Pointer imageROI = MultiChannelExtractROIFilterType::New(); imageROI->SetInput(imageIn); @@ -204,7 +204,7 @@ private: imageROI->SetSizeX(sizeX); imageROI->SetSizeY(sizeY); imageROI->Update(); - + //Tiles extraction of the segmented image ExtractROIFilterType::Pointer labelImageROI = ExtractROIFilterType::New(); labelImageROI->SetInput(labelIn); @@ -213,7 +213,7 @@ private: labelImageROI->SetSizeX(sizeX); labelImageROI->SetSizeY(sizeY); labelImageROI->Update(); - + //Sums calculation for the mean and the variance calculation per label LabelImageIterator itLabel( labelImageROI->GetOutput(), labelImageROI->GetOutput()->GetLargestPossibleRegion()); ImageIterator itImage( imageROI->GetOutput(), imageROI->GetOutput()->GetLargestPossibleRegion()); @@ -260,7 +260,7 @@ private: sqloss.str(""); sqloss<<"SELECT * FROM \""<<layername<<"\" ORDER BY label"; otb::ogr::Layer layerTmp=ogrDS->ExecuteSQL(sqloss.str().c_str(), NULL, NULL); - + bool goesOn = true; int nbFeatures = layerTmp.ogr().GetFeatureCount(true); int nb = 0; @@ -271,7 +271,7 @@ private: while(firstFeature.addr()) { LabelImagePixelType curLabel = firstFeature.ogr().GetFieldAsInteger("label"); - + //Creation of a multipolygon where are stored the geometries to be merged OGRMultiPolygon geomToMerge; geomToMerge.addGeometry(firstFeature.GetGeometry()); @@ -282,12 +282,12 @@ private: while(merging) { nextFeature = layerTmp.ogr().GetNextFeature(); - + if(nextFeature.addr()) { LabelImagePixelType newLabel = nextFeature.ogr().GetFieldAsInteger("label"); merging=(newLabel==curLabel); - + //Storing of the new geometry if labels are identical if(merging) { @@ -329,27 +329,27 @@ private: var = (sum2[curLabel][comp]-sum[curLabel][comp]*sum[curLabel][comp]/nbPixels[curLabel])/(nbPixels[curLabel]-1); firstFeature.ogr().SetField(fieldoss.str().c_str(),var); } - + //Geometries simplification otb::ogr::UniqueGeometryPtr geom = otb::ogr::Simplify(*firstFeature.GetGeometry(),0); firstFeature.SetGeometryDirectly(otb::ogr::Simplify(*geom,0)); - + layer.SetFeature(firstFeature); - + //Next geometry firstFeature=nextFeature; } - + layer.ogr().CommitTransaction(); - + if(extension=="shp"){ sqloss.str(""); sqloss<<"REPACK "<<layername; ogrDS->ogr().ExecuteSQL(sqloss.str().c_str(), NULL, NULL); } - + ogrDS->SyncToDisk(); - + clock_t toc = clock(); otbAppLogINFO(<<"Elapsed time: "<<(double)(toc - tic) / CLOCKS_PER_SEC<<" seconds"); diff --git a/Applications/Segmentation/otbMeanShiftSmoothing.cxx b/Applications/Segmentation/otbMeanShiftSmoothing.cxx index 1fc9325c9e..39976127e3 100644 --- a/Applications/Segmentation/otbMeanShiftSmoothing.cxx +++ b/Applications/Segmentation/otbMeanShiftSmoothing.cxx @@ -111,7 +111,7 @@ private: SetDocExampleParameterValue("maxiter", "100"); } - + void DoUpdateParameters() { // Nothing to do here : all parameters are independent diff --git a/Applications/Segmentation/otbSegmentation.cxx b/Applications/Segmentation/otbSegmentation.cxx index a8aef0835e..5a4a834d4d 100644 --- a/Applications/Segmentation/otbSegmentation.cxx +++ b/Applications/Segmentation/otbSegmentation.cxx @@ -731,7 +731,7 @@ private: AddProcess(fusionFilter, "Stitching polygons"); fusionFilter->GenerateData(); - + //REPACK the Layer in case of Shapefile. //This request will remove features marked as deleted in the .dbf filename, //and recomputed FID for each features (without holes). @@ -743,7 +743,7 @@ private: otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl); //In Shapefile format, the name of the DaaSource is also the name of the Layer. std::string shpLayerName = itksys::SystemTools::GetFilenameWithoutExtension(GetParameterString("mode.vector.out")); - + std::string repack("REPACK "); repack = repack + shpLayerName; ogrDS->ExecuteSQL(repack, NULL, NULL); diff --git a/Applications/Test/otbTestApplication.cxx b/Applications/Test/otbTestApplication.cxx index a699de23c5..86d70293e9 100644 --- a/Applications/Test/otbTestApplication.cxx +++ b/Applications/Test/otbTestApplication.cxx @@ -49,7 +49,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag("Test"); //std::cout << "TestApplication::DoInit" << std::endl; @@ -85,12 +85,12 @@ private: AddParameter(ParameterType_InputImageList, "il", "Input image list"); MandatoryOff("il"); - + AddParameter(ParameterType_ListView, "cl", "Output Image channels"); AddChoice("cl.choice1", "cl.choice1"); AddChoice("cl.choice2", "cl.choice2"); MandatoryOff("cl"); - + AddParameter(ParameterType_ComplexInputImage, "cin", "Input Complex Image"); AddParameter(ParameterType_ComplexOutputImage, "cout", "Output Complex Image"); diff --git a/Applications/Utils/otbBandMath.cxx b/Applications/Utils/otbBandMath.cxx index df42574f09..a12b56a713 100644 --- a/Applications/Utils/otbBandMath.cxx +++ b/Applications/Utils/otbBandMath.cxx @@ -80,7 +80,7 @@ private: SetDocExampleParameterValue("out", "apTvUtBandMathOutput.tif"); SetDocExampleParameterValue("exp", "\"cos(im1b1)+im2b1*im3b1-im3b2+ndvi(im3b3, im3b4)\""); } - + void DoUpdateParameters() { // Check if the expression is correctly set @@ -95,16 +95,16 @@ private: // Initialize a bandMath Filter first m_ChannelExtractorList = ExtractROIFilterListType::New(); m_Filter = BandMathImageFilterType::New(); - + FloatVectorImageListType::Pointer inList = GetParameterImageList("il"); unsigned int nbInputs = inList->Size(); unsigned int imageId = 0, bandId = 0; - + for (unsigned int i = 0; i < nbInputs; i++) { FloatVectorImageType::Pointer currentImage = inList->GetNthElement(i); currentImage->UpdateOutputInformation(); - + for (unsigned int j = 0; j < currentImage->GetNumberOfComponentsPerPixel(); j++) { std::ostringstream tmpParserVarName; @@ -151,7 +151,7 @@ private: } } } - + void DoExecute() { // Get the input image list @@ -213,5 +213,5 @@ private: OTB_APPLICATION_EXPORT(otb::Wrapper::BandMath) - - + + diff --git a/Applications/Utils/otbColorMapping.cxx b/Applications/Utils/otbColorMapping.cxx index cde270ba26..108dbb0f20 100644 --- a/Applications/Utils/otbColorMapping.cxx +++ b/Applications/Utils/otbColorMapping.cxx @@ -225,7 +225,7 @@ public: typedef itk::VariableLengthVector<RealScalarType> InternalPixelType; typedef otb::ListSampleToHistogramListGenerator <ListSampleType, ScalarType, DFContainerType> HistogramFilterType; - //typedef itk::Statistics::Histogram + //typedef itk::Statistics::Histogram //<RealScalarType, DFContainerType> HistogramType; typedef HistogramFilterType::HistogramType HistogramType; typedef HistogramFilterType::HistogramListType HistogramListType; @@ -474,7 +474,7 @@ private: else if (GetParameterInt("method") == 2) { otbAppLogINFO("Color mapping with an optimized look-up table"); - + m_CasterToLabelImage = CasterToLabelImageType::New(); m_CasterToLabelImage->SetInput(GetParameterFloatImage("in")); m_CasterToLabelImage->InPlaceOn(); @@ -592,7 +592,7 @@ private: minVal.SetElement(index, static_cast<FloatVectorImageType::PixelType::ValueType> (histogramList->GetNthElement(index)->Quantile(0, static_cast<float> (this->GetParameterInt("method.image.low"))/ 100.0))); maxVal.SetElement(index, static_cast<FloatVectorImageType::PixelType::ValueType> (histogramList->GetNthElement(index)->Quantile(0, (100.0- static_cast<float> (this->GetParameterInt("method.image.up")))/ 100.0))); } - + m_CasterToLabelImage = CasterToLabelImageType::New(); m_CasterToLabelImage->SetInput(GetParameterFloatImage("in")); m_CasterToLabelImage->InPlaceOn(); diff --git a/Applications/Utils/otbCompareImages.cxx b/Applications/Utils/otbCompareImages.cxx index 19d5021bc7..887a745ef7 100644 --- a/Applications/Utils/otbCompareImages.cxx +++ b/Applications/Utils/otbCompareImages.cxx @@ -57,7 +57,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("BandMath application, ImageStatistics"); - + AddDocTag("Statistics"); AddParameter(ParameterType_Group, "ref", "Reference image properties"); @@ -77,22 +77,22 @@ private: SetMinimumParameterIntValue("meas.channel", 1); AddParameter(ParameterType_Group, "roi", "Region Of Interest (relative to reference image)"); - + AddParameter(ParameterType_Int, "roi.startx", "Start X"); SetDefaultParameterInt("roi.startx", 0); SetMinimumParameterIntValue("roi.startx", 0); SetParameterDescription("roi.startx", "ROI start x position."); - + AddParameter(ParameterType_Int, "roi.starty", "Start Y"); SetDefaultParameterInt("roi.starty", 0); SetMinimumParameterIntValue("roi.starty", 0); SetParameterDescription("roi.starty", "ROI start y position."); - + AddParameter(ParameterType_Int, "roi.sizex", "Size X"); SetDefaultParameterInt("roi.sizex", 0); SetMinimumParameterIntValue("roi.sizex", 1); SetParameterDescription("roi.sizex","Size along x in pixels."); - + AddParameter(ParameterType_Int, "roi.sizey", "Size Y"); SetDefaultParameterInt("roi.sizey", 0); SetMinimumParameterIntValue("roi.sizey", 1); @@ -134,28 +134,28 @@ private: } // ROI - + if ( HasValue("ref.in") ) { FloatVectorImageType::RegionType largestRegion = this->GetParameterImage("ref.in")->GetLargestPossibleRegion(); - + // Put the limit of the index and the size relative the image SetMinimumParameterIntValue("roi.sizex", 1); SetMaximumParameterIntValue("roi.sizex", largestRegion.GetSize(0)); - + SetMinimumParameterIntValue("roi.sizey", 1); SetMaximumParameterIntValue("roi.sizey", largestRegion.GetSize(1)); SetMinimumParameterIntValue("roi.startx", 0); SetMaximumParameterIntValue("roi.startx", largestRegion.GetSize(0) - 1); - + SetMinimumParameterIntValue("roi.starty", 0); SetMaximumParameterIntValue("roi.starty", largestRegion.GetSize(1) - 1); } } - + void DoExecute() { // Init filters @@ -173,7 +173,7 @@ private: region.SetIndex(1, GetParameterInt("roi.starty")); region.SetSize(0, GetParameterInt("roi.sizex")); region.SetSize(1, GetParameterInt("roi.sizey")); - + if (region.GetNumberOfPixels() == 0) { otbAppLogINFO( << "Using whole reference image since the ROI contains no pixels or is not specified" ); @@ -181,7 +181,7 @@ private: } otbAppLogDEBUG( << "Region of interest used for comparison : " << region ); - + if( !region.Crop(refIm->GetLargestPossibleRegion()) || !region.Crop(measIm->GetLargestPossibleRegion()) ) { otbAppLogFATAL( << "ROI is not contained in the images regions"); @@ -212,8 +212,8 @@ private: SetParameterFloat( "mae", m_CompareFilter->GetMAE() ); SetParameterFloat( "psnr", m_CompareFilter->GetPSNR() ); } - - + + ExtractROIMonoFilterType::Pointer m_ExtractRefFilter; ExtractROIMonoFilterType::Pointer m_ExtractMeasFilter; StreamingCompareImageFilterType::Pointer m_CompareFilter; diff --git a/Applications/Utils/otbConcatenateImages.cxx b/Applications/Utils/otbConcatenateImages.cxx index e0510839de..5e2d7f707a 100644 --- a/Applications/Utils/otbConcatenateImages.cxx +++ b/Applications/Utils/otbConcatenateImages.cxx @@ -64,7 +64,7 @@ private: SetDocLimitations("All input images must have the same size."); SetDocAuthors("OTB-Team"); SetDocSeeAlso("Rescale application, Convert"); - + AddDocTag(Tags::Manip); AddDocTag("Concatenation"); AddDocTag("Multi-channel"); @@ -78,9 +78,9 @@ private: AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "The concatenated output image"); - + AddRAMParameter(); - + // Doc example parameter settings SetDocExampleParameterValue("il", "GomaAvant.png GomaApres.png"); SetDocExampleParameterValue("out", "otbConcatenateImages.tif"); @@ -89,7 +89,7 @@ private: void DoUpdateParameters() { // Nothing to do here for the parameters : all are independent - + // Reinitialize the object m_Concatener = ListConcatenerFilterType::New(); m_ImageList = ImageListType::New(); @@ -136,7 +136,7 @@ private: SetParameterOutputImage("out", m_Concatener->GetOutput()); } - + ListConcatenerFilterType::Pointer m_Concatener; ExtractROIFilterListType::Pointer m_ExtractorList; diff --git a/Applications/Utils/otbConcatenateVectorData.cxx b/Applications/Utils/otbConcatenateVectorData.cxx index d937771ef6..c7d5c1cb97 100644 --- a/Applications/Utils/otbConcatenateVectorData.cxx +++ b/Applications/Utils/otbConcatenateVectorData.cxx @@ -67,7 +67,7 @@ private: // Doc example parameter settings SetDocExampleParameterValue("vd", "ToulousePoints-examples.shp ToulouseRoad-examples.shp"); SetDocExampleParameterValue("out", "ConcatenatedVectorData.shp"); - + } @@ -80,10 +80,10 @@ private: { // Get the input VectorData list VectorDataListType* vectorDataList = GetParameterVectorDataList("vd"); - + // Concatenate filter object m_ConcatenateFilter = ConcatenateFilterType::New(); - + for (unsigned int idx = 0; idx < vectorDataList->Size(); idx++) { m_ConcatenateFilter->AddInput(vectorDataList->GetNthElement(idx)); @@ -92,7 +92,7 @@ private: // Set the output SetParameterOutputVectorData("out", m_ConcatenateFilter->GetOutput()); } - + ConcatenateFilterType::Pointer m_ConcatenateFilter; }; diff --git a/Applications/Utils/otbDEMConvert.cxx b/Applications/Utils/otbDEMConvert.cxx index 43594e6b66..921844e0f8 100644 --- a/Applications/Utils/otbDEMConvert.cxx +++ b/Applications/Utils/otbDEMConvert.cxx @@ -85,21 +85,21 @@ void DoExecute() { // Load input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); - + // Set temporary tif filename (for ossim) std::string ofname = GetParameterString("out"); std::string path = itksys::SystemTools::GetFilenamePath(ofname); std::string fname = itksys::SystemTools::GetFilenameWithoutExtension(ofname); std::string tempFilename = path+"/"+fname+"_DEMConvert.tif"; std::string tempFilenameGeom = path+"/"+fname+"_DEMConvert.geom"; - + // Generate the tif image using OTB while keeping the same pixel // type then the input image // Initialize an outputParameter and set its output pixeltype OutputImageParameter::Pointer paramOut = OutputImageParameter::New(); std::ostringstream osswriter; osswriter<< "writing temporary tif file"; - + // Set the filename of the current output image paramOut->SetFileName(tempFilename); paramOut->SetValue(inImage); @@ -157,7 +157,7 @@ void DoExecute() { itkExceptionMacro("Problem while removing the file " << tempFilename); } - + // remove the geom file if any if( itksys::SystemTools::FileExists(tempFilenameGeom.c_str()) && !itksys::SystemTools::RemoveFile(tempFilenameGeom.c_str())) diff --git a/Applications/Utils/otbExtractROI.cxx b/Applications/Utils/otbExtractROI.cxx index ea81379ebb..ad4c319cdf 100644 --- a/Applications/Utils/otbExtractROI.cxx +++ b/Applications/Utils/otbExtractROI.cxx @@ -52,7 +52,7 @@ public: /** Filters typedef */ typedef otb::MultiChannelExtractROI<FloatVectorImageType::InternalPixelType, FloatVectorImageType::InternalPixelType> ExtractROIFilterType; - + private: void DoInit() { @@ -122,13 +122,13 @@ private: { ExtractROIFilterType::InputImageType* inImage = GetParameterImage("in"); ExtractROIFilterType::InputImageType::RegionType largestRegion = inImage->GetLargestPossibleRegion(); - + if (!HasUserValue("sizex") && !HasUserValue("sizey") ) { SetParameterInt("sizex", largestRegion.GetSize()[0]); SetParameterInt("sizey", largestRegion.GetSize()[1]); } - + // Update the values of the channels to be selected unsigned int nbComponents = inImage->GetNumberOfComponentsPerPixel(); ClearChoices("cl"); @@ -139,20 +139,20 @@ private: item<<"Channel"<<idx+1; AddChoice(key.str(), item.str()); } - + // Put the limit of the index and the size relative the image SetMinimumParameterIntValue("sizex", 0); SetMaximumParameterIntValue("sizex", largestRegion.GetSize(0)); - + SetMinimumParameterIntValue("sizey", 0); SetMaximumParameterIntValue("sizey", largestRegion.GetSize(1)); - + SetMinimumParameterIntValue("startx", 0); SetMaximumParameterIntValue("startx", largestRegion.GetSize(0)); - + SetMinimumParameterIntValue("starty", 0); SetMaximumParameterIntValue("starty", largestRegion.GetSize(1)); - + // Crop the roi region to be included in the largest possible // region if(!this->CropRegionOfInterest()) @@ -198,7 +198,7 @@ private: region.SetSize(1, GetParameterInt("sizey")); region.SetIndex(0, GetParameterInt("startx")); region.SetIndex(1, GetParameterInt("starty")); - + if ( HasValue("in") ) { if (region.Crop(GetParameterImage("in")->GetLargestPossibleRegion())) @@ -235,7 +235,7 @@ private: rsTransform->InstanciateTransform(); FloatVectorImageType::IndexType uli_ref,uri_ref,lli_ref,lri_ref; - + uli_ref = referencePtr->GetLargestPossibleRegion().GetIndex(); uri_ref = uli_ref; uri_ref[0]+=referencePtr->GetLargestPossibleRegion().GetSize()[0]; @@ -293,7 +293,7 @@ private: { m_ExtractROIFilter->SetChannel(GetSelectedItems("cl")[idx] + 1 ); } - + SetParameterOutputImage("out", m_ExtractROIFilter->GetOutput()); } diff --git a/Applications/Utils/otbKmzExport.cxx b/Applications/Utils/otbKmzExport.cxx index d36ddb5c46..ddb8b75c4c 100644 --- a/Applications/Utils/otbKmzExport.cxx +++ b/Applications/Utils/otbKmzExport.cxx @@ -59,15 +59,15 @@ private: AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in", "Input image"); - + AddParameter(ParameterType_OutputFilename, "out", "Output .kmz product"); SetParameterDescription("out", "Output Kmz product directory (with .kmz extension)"); - + AddParameter(ParameterType_Int, "tilesize", "Tile Size"); SetParameterDescription("tilesize", "Size of the tiles in the kmz product, in number of pixels (default = 512)."); SetDefaultParameterInt("tilesize", 512); MandatoryOff("tilesize"); - + AddParameter(ParameterType_InputImage, "logo", "Image logo"); SetParameterDescription("logo", "Path to the image logo to add to the KMZ product."); MandatoryOff("logo"); @@ -94,7 +94,7 @@ private: void DoExecute() { typedef otb::KmzProductWriter<FloatVectorImageType> KmzProductWriterType; - + // Second part : Image To Kmz KmzProductWriterType::Pointer kmzWriter = KmzProductWriterType::New(); kmzWriter->SetInput( this->GetParameterImage("in") ); @@ -111,7 +111,7 @@ private: else itkExceptionMacro(<< "The tile size should be a positive value."); } - + // Add the logo if any if( this->HasValue("logo") ) { @@ -123,7 +123,7 @@ private: { kmzWriter->AddLegend( this->GetParameterImage("legend") ); } - + // trigger the writing kmzWriter->Update(); } diff --git a/Applications/Utils/otbMultiResolutionPyramid.cxx b/Applications/Utils/otbMultiResolutionPyramid.cxx index 7bd9dd0ea5..a6638b2c7b 100644 --- a/Applications/Utils/otbMultiResolutionPyramid.cxx +++ b/Applications/Utils/otbMultiResolutionPyramid.cxx @@ -141,7 +141,7 @@ private: path = itksys::SystemTools::GetFilenamePath(ofname); fname = itksys::SystemTools::GetFilenameWithoutExtension(ofname); ext = itksys::SystemTools::GetFilenameExtension(ofname); - + unsigned int currentLevel = 1; unsigned int currentFactor = shrinkFactor; @@ -172,7 +172,7 @@ private: // Create an output parameter to write the current output image OutputImageParameter::Pointer paramOut = OutputImageParameter::New(); - + // build the current image filename std::ostringstream oss; if (!path.empty()) @@ -196,7 +196,7 @@ private: ++currentLevel; } - + // Disable this parameter since the images have already been produced DisableParameter("out"); } diff --git a/Applications/Utils/otbOSMDownloader.cxx b/Applications/Utils/otbOSMDownloader.cxx index 8a3acd5b71..b20277f830 100644 --- a/Applications/Utils/otbOSMDownloader.cxx +++ b/Applications/Utils/otbOSMDownloader.cxx @@ -43,7 +43,7 @@ public: itkNewMacro(Self); itkTypeMacro(OSMDownloader, otb::Application); - + /** Filter typedef */ typedef otb::OSMDataToVectorDataGenerator VectorDataProviderType; @@ -122,7 +122,7 @@ private: // Get the support image envelopeFilter->SetInput( this->GetParameterImage("support") ); //->Output in WGS84 - + // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); @@ -185,14 +185,14 @@ private: SetParameterOutputVectorData("out", const_cast<VectorDataType*>(m_VdOSMGenerator->GetVectorDataByName(this->GetParameterString("key"), this->GetParameterString("value")))); - + otbAppLogINFO( << m_VdOSMGenerator->GetVectorDataByName(this->GetParameterString("key"), this->GetParameterString("value"))->Size()-3 << " elements retrieved"); } else { SetParameterOutputVectorData("out", const_cast<VectorDataType*>(m_VdOSMGenerator->GetVectorDataByName(this->GetParameterString("key")))); - + otbAppLogINFO( << m_VdOSMGenerator->GetVectorDataByName(this->GetParameterString("key"))->Size()-3 << " elements retrieved"); } diff --git a/Applications/Utils/otbPixelValue.cxx b/Applications/Utils/otbPixelValue.cxx index e7b64dc27e..37a5a972b2 100644 --- a/Applications/Utils/otbPixelValue.cxx +++ b/Applications/Utils/otbPixelValue.cxx @@ -61,7 +61,7 @@ private: AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input image"); - + AddParameter(ParameterType_Int,"coordx","Col index"); SetParameterDescription("coordx","Column index of the wanted pixel (starts at 0)."); SetMinimumParameterIntValue("coordx", 0); @@ -90,7 +90,7 @@ private: if ( HasValue("in") ) { ExtractROIFilterType::InputImageType* inImage = GetParameterImage("in"); - + // Update the values of the channels to be selected unsigned int nbComponents = inImage->GetNumberOfComponentsPerPixel(); ClearChoices("cl"); @@ -101,7 +101,7 @@ private: item<<"Channel"<<idx+1; AddChoice(key.str(), item.str()); } - + ExtractROIFilterType::InputImageType::RegionType largestRegion = inImage->GetLargestPossibleRegion(); SetMaximumParameterIntValue("coordx", largestRegion.GetSize(0)-1); SetMaximumParameterIntValue("coordy", largestRegion.GetSize(1)-1); @@ -112,7 +112,7 @@ private: { std::ostringstream ossOutput; FloatVectorImageType::Pointer inImage = GetParameterImage("in"); - + ExtractROIFilterType::Pointer extractor = ExtractROIFilterType::New(); extractor->SetInput(inImage); @@ -129,7 +129,7 @@ private: region.SetIndex(id); extractor->SetExtractionRegion(region); - + // Extract the channels if needed if ( GetParameterByKey("cl")->GetActive() ) { diff --git a/Applications/Utils/otbRescale.cxx b/Applications/Utils/otbRescale.cxx index 6ca65308af..ace0ee39f5 100644 --- a/Applications/Utils/otbRescale.cxx +++ b/Applications/Utils/otbRescale.cxx @@ -121,10 +121,10 @@ private: m_RescaleFilter->SetOutputMinimum( outMin ); m_RescaleFilter->SetOutputMaximum( outMax ); m_RescaleFilter->UpdateOutputInformation(); - + SetParameterOutputImage("out", m_RescaleFilter->GetOutput()); } - + RescaleImageFilterType::Pointer m_RescaleFilter; MinMaxFilterType::Pointer m_MinMaxFilter; }; diff --git a/Applications/Utils/otbSplitImage.cxx b/Applications/Utils/otbSplitImage.cxx index 01e34b63cc..48e780b322 100644 --- a/Applications/Utils/otbSplitImage.cxx +++ b/Applications/Utils/otbSplitImage.cxx @@ -88,7 +88,7 @@ private: // Get the path/fileWithoutextension/extension of the output images filename std::string path, fname, ext; std::string ofname = GetParameterString("out"); - + // Get the extension and the prefix of the filename path = itksys::SystemTools::GetFilenamePath(ofname); fname = itksys::SystemTools::GetFilenameWithoutExtension(ofname); @@ -102,7 +102,7 @@ private: { // Set the channel to extract m_Filter->SetChannel(i+1); - + // build the current output filename std::ostringstream oss; if (!path.empty()) @@ -110,10 +110,10 @@ private: oss <<path<<"/"; } oss <<fname<<"_"<<i<<ext; - + // Create an output parameter to write the current output image OutputImageParameter::Pointer paramOut = OutputImageParameter::New(); - + // writer label std::ostringstream osswriter; osswriter<< "writer (Channel : "<< i<<")"; @@ -139,4 +139,4 @@ private: } OTB_APPLICATION_EXPORT(otb::Wrapper::SplitImage) - + diff --git a/Applications/Utils/otbTileFusion.cxx b/Applications/Utils/otbTileFusion.cxx index 5c8eb259e2..9140183ce4 100644 --- a/Applications/Utils/otbTileFusion.cxx +++ b/Applications/Utils/otbTileFusion.cxx @@ -53,21 +53,21 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Manip); AddParameter(ParameterType_InputImageList, "il", "Input Tile Images"); SetParameterDescription("il", "Input tiles to concatenate (in lexicographic order : (0,0) (1,0) (0,1) (1,1))."); - + AddParameter(ParameterType_Int, "cols", "Number of tile columns"); SetParameterDescription("cols", "Number of columns in the tile array"); - + AddParameter(ParameterType_Int, "rows", "Number of tile rows"); SetParameterDescription("rows", "Number of rows in the tile array"); - + AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "Output entire image"); - + // Doc example parameter settings SetDocExampleParameterValue("il", "Scene_R1C1.tif Scene_R1C2.tif Scene_R2C1.tif Scene_R2C2.tif"); SetDocExampleParameterValue("cols","2"); @@ -89,22 +89,22 @@ private: { itkExceptionMacro("No input Image set..."); } - + m_FusionFilter = TileFilterType::New(); TileFilterType::SizeType layout; layout[0] = this->GetParameterInt("cols"); layout[1] = this->GetParameterInt("rows"); m_FusionFilter->SetLayout(layout); - + for (unsigned int i=0; i<(layout[0]*layout[1]); i++) { m_FusionFilter->SetInput(i,tileList->GetNthElement(i)); } - + SetParameterOutputImage("out", m_FusionFilter->GetOutput()); } - + TileFilterType::Pointer m_FusionFilter; }; diff --git a/Applications/Utils/otbVectorDataExtractROIApplication.cxx b/Applications/Utils/otbVectorDataExtractROIApplication.cxx index 3ee86702e8..8fa189834f 100644 --- a/Applications/Utils/otbVectorDataExtractROIApplication.cxx +++ b/Applications/Utils/otbVectorDataExtractROIApplication.cxx @@ -51,12 +51,12 @@ public: /** Filters typedef */ // Images - + typedef FloatVectorImageType::PointType PointType; typedef FloatVectorImageType::IndexType IndexType; typedef FloatVectorImageType::SizeType SizeType; typedef FloatVectorImageType::SpacingType SpacingType; - + typedef VectorDataProjectionFilter< VectorDataType, VectorDataType> VectorDataProjectionFilterType; typedef VectorDataExtractROI<VectorDataType> VectorDataExtractROIType; @@ -80,13 +80,13 @@ private: AddParameter(ParameterType_Group,"io","Input and output data"); SetParameterDescription("io", "Group containing input and output parameters"); - + AddParameter(ParameterType_InputVectorData, "io.vd", "Input Vector data"); SetParameterDescription("io.vd", "Input vector data"); - + AddParameter(ParameterType_InputImage, "io.in", "Support image"); SetParameterDescription("io.in", "Support image that specifies the extracted region"); - + AddParameter(ParameterType_OutputVectorData,"io.out","Output Vector data"); SetParameterDescription("io.out", "Output extracted vector data"); @@ -109,11 +109,11 @@ private: // Get the inputs VectorDataType* vd = GetParameterVectorData("io.vd"); FloatVectorImageType* inImage = GetParameterImage("io.in"); - + // Extracting the VectorData m_VdExtract = VectorDataExtractROIType::New(); m_VdExtract->SetInput(vd); - + // Find the geographic region of interest // Get the index of the corner of the image IndexType ul, ur, ll, lr; @@ -141,7 +141,7 @@ private: rsOrigin[1] = std::min(pul[1], plr[1]); rsSize[0] = vcl_abs(pul[0] - plr[0]); rsSize[1] = vcl_abs(pul[1] - plr[1]); - + rsRegion.SetOrigin(rsOrigin); rsRegion.SetSize(rsSize); rsRegion.SetRegionProjection(inImage->GetProjectionRef()); @@ -165,7 +165,7 @@ private: // Set the output vectorData SetParameterOutputVectorData("io.out", m_VdProj->GetOutput()); } - + VectorDataExtractROIType::Pointer m_VdExtract; VectorDataProjectionFilterType::Pointer m_VdProj; }; diff --git a/Applications/Utils/otbVectorDataSetField.cxx b/Applications/Utils/otbVectorDataSetField.cxx index 061f4457b4..6f0d0ef888 100644 --- a/Applications/Utils/otbVectorDataSetField.cxx +++ b/Applications/Utils/otbVectorDataSetField.cxx @@ -58,7 +58,7 @@ private: SetParameterDescription("in", "Input Vector Data"); AddParameter(ParameterType_OutputVectorData, "out", "Output"); SetParameterDescription("out", "Output Vector Data"); - + AddParameter(ParameterType_String, "fn", "Field"); SetParameterDescription("fn", "Field name"); AddParameter(ParameterType_String, "fv", "Value"); @@ -75,11 +75,11 @@ private: { // Nothing to do (for now) } - + void DoExecute() { m_InputData = GetParameterVectorData("in"); - + typedef VectorDataType::DataTreeType DataTreeType; typedef itk::PreOrderTreeIterator<DataTreeType> TreeIteratorType; TreeIteratorType it(m_InputData->GetDataTree()); @@ -92,7 +92,7 @@ private: SetParameterOutputVectorData("out", m_InputData); } - + VectorDataType::Pointer m_InputData; }; diff --git a/Applications/Utils/otbVectorDataTransform.cxx b/Applications/Utils/otbVectorDataTransform.cxx index 8044740ea1..3fb4a0aeef 100644 --- a/Applications/Utils/otbVectorDataTransform.cxx +++ b/Applications/Utils/otbVectorDataTransform.cxx @@ -55,24 +55,24 @@ private: { SetName("VectorDataTransform"); SetDescription("Apply a transform to each vertex of the input VectorData"); - + SetDocName("Vector Data Transformation"); SetDocLongDescription("This application performs a transformation of an input vector data transforming each vertex in the vector data. The applied transformation manages translation, rotation and scale, and can be centered or not."); SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - + AddDocTag(Tags::Vector); AddParameter(ParameterType_InputVectorData, "vd", "Input Vector data"); SetParameterDescription("vd", "Input vector data to transform"); - + AddParameter(ParameterType_OutputVectorData,"out","Output Vector data"); SetParameterDescription("out", "Output transformed vector data"); AddParameter(ParameterType_InputImage, "in", "Support image"); SetParameterDescription("in","Image needed as a support to the vector data"); - + // Transform Group AddParameter(ParameterType_Group, "transform", "Transform parameters"); SetParameterDescription("transform", "Group of parameters to define the transform"); @@ -83,7 +83,7 @@ private: SetParameterDescription("transform.ty","Translation in the Y direction (in pixels)"); SetDefaultParameterFloat("transform.tx", 0.); SetDefaultParameterFloat("transform.ty", 0.); - + AddParameter(ParameterType_Float, "transform.ro", "Rotation Angle"); SetParameterDescription("transform.ro","Angle of the rotation to apply in degrees"); SetDefaultParameterFloat("transform.ro", 0.); @@ -115,17 +115,17 @@ private: { // Get the support image FloatVectorImageType* inImage = GetParameterImage("in"); - + // Get the VectorData to apply the transform on VectorDataType* vd = GetParameterVectorData("vd"); - + // Reproject the VectorData in the image coordinate system m_VectorDataProj = VectorDataProjectionFilterType::New(); m_VectorDataProj->SetInput(vd); m_VectorDataProj->SetInputProjectionRef(vd->GetProjectionRef()); m_VectorDataProj->SetOutputKeywordList(inImage->GetImageKeywordlist()); m_VectorDataProj->SetOutputProjectionRef(inImage->GetProjectionRef()); - + // Set up the transform m_Transform = TransformType::New(); TransformType::ParametersType parameters(6); @@ -137,14 +137,14 @@ private: parameters[3] = GetParameterFloat("transform.centery"); parameters[4] = inImage->GetSpacing()[0] * GetParameterFloat("transform.tx"); parameters[5] = vcl_abs(inImage->GetSpacing()[1]) * GetParameterFloat("transform.ty"); - + // Set the parameters to the transform m_Transform->SetParameters(parameters); - + m_TransformFilter = VectorDataTransformFilterType::New(); m_TransformFilter->SetInput(m_VectorDataProj->GetOutput()); m_TransformFilter->SetTransform(m_Transform); - + // retransform int the input vector projection m_ReverseVectorDataProj = VectorDataProjectionFilterType::New(); m_ReverseVectorDataProj->SetInput(m_TransformFilter->GetOutput()); -- GitLab