From f9dd799fb428eb24f1fda5179c13f66ae79e1359 Mon Sep 17 00:00:00 2001 From: OTB Bot <otbbot@orfeo-toolbox.org> Date: Mon, 5 Apr 2010 20:47:40 +0800 Subject: [PATCH] STYLE --- .../otbAmplitudePhaseToRGBFunctor.cxx | 21 +- .../otbAmplitudePhaseToRGBFunctorNew.cxx | 10 +- .../otbBSplineDecompositionImageFilter.cxx | 8 +- .../otbBSplineDecompositionImageFilterNew.cxx | 4 +- .../otbBSplineInterpolateImageFunction.cxx | 28 +- .../otbBSplineInterpolateImageFunctionNew.cxx | 4 +- .../BasicFilters/otbBasicFiltersTests10.cxx | 1 - .../BasicFilters/otbBasicFiltersTests11.cxx | 1 - .../BasicFilters/otbBasicFiltersTests12.cxx | 1 - .../BasicFilters/otbBasicFiltersTests2.cxx | 1 - .../BasicFilters/otbBasicFiltersTests3.cxx | 1 - .../BasicFilters/otbBasicFiltersTests4.cxx | 1 - .../BasicFilters/otbBasicFiltersTests5.cxx | 27 +- .../BasicFilters/otbBasicFiltersTests6.cxx | 1 - .../BasicFilters/otbBasicFiltersTests7.cxx | 2 - .../BasicFilters/otbBasicFiltersTests8.cxx | 1 - .../BasicFilters/otbBasicFiltersTests9.cxx | 1 - .../otbBinaryImageDensityFunction.cxx | 55 ++- .../otbBinaryImageDensityFunctionNew.cxx | 13 +- ...ryImageMinimalBoundingRegionCalculator.cxx | 41 ++- ...mageMinimalBoundingRegionCalculatorNew.cxx | 5 +- .../otbBinaryImageToDensityImageFilter.cxx | 35 +- .../otbBinaryImageToDensityImageFilterNew.cxx | 16 +- .../otbBoxAndWhiskerImageFilterNew.cxx | 14 +- .../otbChangeLabelImageFilter.cxx | 38 +- .../otbChangeLabelImageFilterNew.cxx | 5 +- .../Code/BasicFilters/otbClosePathFunctor.cxx | 57 ++- .../otbClosingOpeningMorphologicalFilter.cxx | 13 +- ...tbClosingOpeningMorphologicalFilterNew.cxx | 15 +- ...AndClassicalConvolutionWithGaborFilter.cxx | 63 ++-- ...inuousMinimumMaximumImageCalculatorNew.cxx | 4 +- ...nuousMinimumMaximumImageCalculatorTest.cxx | 48 ++- .../otbConvolutionImageFilter.cxx | 31 +- .../otbConvolutionImageFilterNew.cxx | 16 +- .../otbEdgeDensityImageFilter.cxx | 50 ++- .../otbEdgeDensityImageFilterNew.cxx | 20 +- .../otbEdgeDetectorImageFilter.cxx | 18 +- .../otbEdgeDetectorImageFilterNew.cxx | 8 +- .../otbEstimateInnerProductPCAImageFilter.cxx | 22 +- ...bEstimateInnerProductPCAImageFilterNew.cxx | 6 +- .../otbEuclideanDistanceWithMissingValue.cxx | 21 +- ...tbEuclideanDistanceWithMissingValueNew.cxx | 9 +- .../BasicFilters/otbExtractROIResample.cxx | 33 +- .../otbFlexibleDistanceWithMissingValue.cxx | 39 +-- ...otbFlexibleDistanceWithMissingValueNew.cxx | 11 +- Testing/Code/BasicFilters/otbFrostFilter.cxx | 44 ++- .../Code/BasicFilters/otbFrostFilterNew.cxx | 16 +- .../BasicFilters/otbFunctionToImageFilter.cxx | 15 +- .../otbFunctionToImageFilterNew.cxx | 4 +- ...bFunctionWithNeighborhoodToImageFilter.cxx | 32 +- ...nctionWithNeighborhoodToImageFilterNew.cxx | 29 +- .../BasicFilters/otbGaborFilterGenerator.cxx | 56 +-- .../otbGaborFilterGeneratorNew.cxx | 2 +- ...bImageAndVectorImageOperationFilterNew.cxx | 11 +- ...ImageAndVectorImageOperationFilterTest.cxx | 29 +- .../otbImageListToImageListApplyFilter.cxx | 14 +- .../otbImageListToImageListApplyFilterNew.cxx | 11 +- .../otbImageListToVectorImageFilter.cxx | 11 +- .../otbImageListToVectorImageFilter2.cxx | 27 +- .../otbImageListToVectorImageFilterNew.cxx | 9 +- .../otbImagePCAShapeModelEstimatorTest.cxx | 54 ++- .../otbImageToPointSetFilterTest.cxx | 12 +- .../otbImportGeoInformationImageFilter.cxx | 19 +- .../otbImportGeoInformationImageFilterNew.cxx | 7 +- ...oInformationImageFilterWithKeywordList.cxx | 16 +- .../otbInnerProductPCAImageFilter.cxx | 42 +-- .../otbInnerProductPCAImageFilterNew.cxx | 6 +- .../otbInverseLogPolarTransform.cxx | 75 ++-- .../otbInverseLogPolarTransformNew.cxx | 3 +- .../otbInverseLogPolarTransformResample.cxx | 38 +- .../otbKeyPointDensityImageFilterNew.cxx | 21 +- .../otbKeyPointDensityImageFilterTest.cxx | 38 +- ...LabelizeConfidenceConnectedImageFilter.cxx | 24 +- ...elizeConfidenceConnectedImageFilterNew.cxx | 4 +- ...bLabelizeConnectedThresholdImageFilter.cxx | 24 +- ...belizeConnectedThresholdImageFilterNew.cxx | 4 +- ...belizeNeighborhoodConnectedImageFilter.cxx | 23 +- ...izeNeighborhoodConnectedImageFilterNew.cxx | 4 +- Testing/Code/BasicFilters/otbLeeFilter.cxx | 42 +-- .../otbListSampleToHistogramListGenerator.cxx | 24 +- ...bListSampleToHistogramListGeneratorNew.cxx | 4 +- ...eToVariableDimensionHistogramGenerator.cxx | 22 +- ...VariableDimensionHistogramGeneratorNew.cxx | 4 +- .../BasicFilters/otbLogPolarTransform.cxx | 57 ++- .../BasicFilters/otbLogPolarTransformNew.cxx | 3 +- .../otbLogPolarTransformResample.cxx | 36 +- .../otbMatrixTransposeMatrixImageFilter.cxx | 24 +- ...otbMatrixTransposeMatrixImageFilterNew.cxx | 14 +- .../BasicFilters/otbMeanFunctorImageTest.cxx | 10 +- .../BasicFilters/otbMeanShiftImageFilter.cxx | 36 +- .../otbMeanShiftImageFilterNew.cxx | 6 +- .../otbMeanShiftVectorImageFilter.cxx | 36 +- .../otbMeanShiftVectorImageFilterNew.cxx | 6 +- ...otbNormalizeInnerProductPCAImageFilter.cxx | 22 +- ...NormalizeInnerProductPCAImageFilterNew.cxx | 6 +- .../otbOpeningClosingMorphologicalFilter.cxx | 13 +- ...tbOpeningClosingMorphologicalFilterNew.cxx | 15 +- .../otbOverlapSaveConvolutionImageFilter.cxx | 29 +- ...tbOverlapSaveConvolutionImageFilterNew.cxx | 16 +- .../BasicFilters/otbPathLengthFunctor.cxx | 59 ++-- .../otbPerBandVectorImageFilterNew.cxx | 11 +- ...PerBandVectorImageFilterWithMeanFilter.cxx | 11 +- ...erBandVectorImageFilterWithSobelFilter.cxx | 11 +- .../otbPersistentVectorizationFilter.cxx | 22 +- .../otbPersistentVectorizationFilterNew.cxx | 6 +- .../otbPointSetDensityFunctionNew.cxx | 16 +- .../otbPointSetDensityFunctionTest.cxx | 31 +- .../otbPointSetToDensityImageFilterNew.cxx | 18 +- .../otbPointSetToDensityImageFilterTest.cxx | 37 +- .../otbPolygonCompacityFunctor.cxx | 59 ++-- .../BasicFilters/otbPrintableImageFilter.cxx | 27 +- .../otbPrintableImageFilterNew.cxx | 10 +- .../otbPrintableImageFilterWithMask.cxx | 45 +-- .../otbProlateInterpolateImageFunction.cxx | 52 ++- .../otbProlateInterpolateImageFunctionNew.cxx | 4 +- .../BasicFilters/otbProlateValidationTest.cxx | 37 +- .../Code/BasicFilters/otbResampleSLCImage.cxx | 21 +- .../otbScalarImageTextureFunctor.cxx | 19 +- .../otbScalarImageTextureFunctorNew.cxx | 10 +- .../otbScalarToRainbowRGBPixelFunctor.cxx | 5 +- .../otbScalarToRainbowRGBPixelFunctorNew.cxx | 10 +- .../otbScalarVectorImageTextureFunctor.cxx | 24 +- .../otbScalarVectorImageTextureFunctorNew.cxx | 14 +- .../otbSpatialObjectToImageDrawingFilter.cxx | 29 +- ...tbSpatialObjectToImageDrawingFilterNew.cxx | 9 +- .../otbSpectralAngleDistanceImageFilter.cxx | 25 +- ...otbSpectralAngleDistanceImageFilterNew.cxx | 9 +- ...StreamingInnerProductVectorImageFilter.cxx | 17 +- ...eamingInnerProductVectorImageFilterNew.cxx | 4 +- .../otbStreamingResampleImageFilter.cxx | 28 +- ...amingResampleImageFilterCompareWithITK.cxx | 34 +- .../otbStreamingResampleImageFilterNew.cxx | 14 +- .../otbStreamingShrinkImageFilter.cxx | 20 +- .../otbStreamingShrinkImageFilterNew.cxx | 10 +- .../otbStreamingStatisticsImageFilter.cxx | 19 +- .../otbStreamingStatisticsImageFilterNew.cxx | 3 +- ...tbStreamingStatisticsVectorImageFilter.cxx | 19 +- ...treamingStatisticsVectorImageFilterNew.cxx | 3 +- .../otbTransformPointSetFilterTest.cxx | 82 +++-- ...UnaryImageFunctorWithVectorImageFilter.cxx | 23 +- ...ryImageFunctorWithVectorImageFilterNew.cxx | 12 +- .../BasicFilters/otbVarianceImageFilter.cxx | 8 +- .../otbVarianceImageFilterNew.cxx | 4 +- .../otbVectorImageTo3DScalarImageFilter.cxx | 26 +- ...otbVectorImageTo3DScalarImageFilterNew.cxx | 6 +- .../otbVectorImageToAmplitudeImageFilter.cxx | 10 +- ...tbVectorImageToAmplitudeImageFilterNew.cxx | 6 +- .../otbVectorImageToImageListFilter.cxx | 22 +- .../otbVectorImageToImageListFilterNew.cxx | 11 +- .../otbVectorImageToIntensityImageFilter.cxx | 13 +- ...tbVectorImageToIntensityImageFilterNew.cxx | 9 +- .../otbVectorRescaleIntensityImageFilter.cxx | 27 +- ...tbVectorRescaleIntensityImageFilterNew.cxx | 11 +- ...edSincInterpolateImageBlackmanFunction.cxx | 35 +- ...incInterpolateImageBlackmanFunctionNew.cxx | 7 +- ...owedSincInterpolateImageCosineFunction.cxx | 35 +- ...dSincInterpolateImageCosineFunctionNew.cxx | 7 +- ...wedSincInterpolateImageFunctionBaseNew.cxx | 15 +- ...edSincInterpolateImageGaussianFunction.cxx | 35 +- ...incInterpolateImageGaussianFunctionNew.cxx | 7 +- ...wedSincInterpolateImageHammingFunction.cxx | 35 +- ...SincInterpolateImageHammingFunctionNew.cxx | 7 +- ...wedSincInterpolateImageLanczosFunction.cxx | 35 +- ...SincInterpolateImageLanczosFunctionNew.cxx | 7 +- ...dowedSincInterpolateImageWelchFunction.cxx | 35 +- ...edSincInterpolateImageWelchFunctionNew.cxx | 7 +- .../otbCBAMIChangeDetectionTest.cxx | 70 ++-- .../otbChangeDetectionTests1.cxx | 12 +- .../otbCorrelChangeDetectionTest.cxx | 72 ++-- .../otbJHMIChangeDetectionTest.cxx | 71 ++-- .../otbKullbackLeiblerDistanceImageFilter.cxx | 30 +- ...bKullbackLeiblerDistanceImageFilterNew.cxx | 6 +- .../otbKullbackLeiblerProfileImageFilter.cxx | 33 +- ...tbKullbackLeiblerProfileImageFilterNew.cxx | 7 +- ...ckLeiblerSupervizedDistanceImageFilter.cxx | 137 ++++---- ...eiblerSupervizedDistanceImageFilterNew.cxx | 12 +- .../otbLHMIChangeDetectionTest.cxx | 71 ++-- .../otbMeanDiffChangeDetectionTest.cxx | 71 ++-- .../otbMeanRatioChangeDetectionTest.cxx | 71 ++-- .../Code/Common/otbArcSpatialObjectNew.cxx | 1 - .../Common/otbAttributesMapLabelObjectNew.cxx | 10 +- ...bAttributesMapOpeningLabelMapFilterNew.cxx | 12 +- Testing/Code/Common/otbCommonTests11.cxx | 1 - Testing/Code/Common/otbCommonTests2.cxx | 4 +- Testing/Code/Common/otbCommonTests3.cxx | 4 +- Testing/Code/Common/otbCommonTests8.cxx | 18 +- Testing/Code/Common/otbCommonTests9.cxx | 8 +- .../otbConcatenateVectorImageFilter.cxx | 17 +- .../otbConcatenateVectorImageFilterNew.cxx | 7 +- Testing/Code/Common/otbConfigurationTest.cxx | 22 +- Testing/Code/Common/otbDataNodeTest.cxx | 51 ++- .../Code/Common/otbDrawLineSpatialObject.cxx | 55 ++- .../Common/otbDrawLineSpatialObjectList.cxx | 54 ++- .../otbDrawLineSpatialObjectListNew.cxx | 18 +- .../Common/otbDrawLineSpatialObjectNew.cxx | 18 +- Testing/Code/Common/otbDrawPathFilter.cxx | 53 ++- Testing/Code/Common/otbDrawPathFilterNew.cxx | 7 +- Testing/Code/Common/otbDrawPathListFilter.cxx | 55 ++- .../Code/Common/otbDrawPathListFilterNew.cxx | 7 +- .../Common/otbDrawPathListFilterWithValue.cxx | 57 ++- Testing/Code/Common/otbExtractROI.cxx | 46 ++- Testing/Code/Common/otbExtractROI2.cxx | 46 ++- Testing/Code/Common/otbExtractROINew.cxx | 13 +- Testing/Code/Common/otbExtractROI_RGB.cxx | 46 ++- .../Common/otbGISTableToLabelMapFilterNew.cxx | 8 +- .../Common/otbGISTableToVectorDataFilter.cxx | 48 ++- .../otbGISTableToVectorDataFilterNew.cxx | 14 +- .../otbGenericInterpolateImageFunctionNew.cxx | 23 +- .../Common/otbHistogramStatisticsFunction.cxx | 62 ++-- Testing/Code/Common/otbImageList.cxx | 15 +- Testing/Code/Common/otbImageListNew.cxx | 7 +- Testing/Code/Common/otbImageListSourceNew.cxx | 7 +- .../Common/otbImageListToImageFilterNew.cxx | 11 +- .../otbImageListToImageListFilterNew.cxx | 11 +- ...bImageOfVectorsToMonoChannelExtractROI.cxx | 16 +- ...ageOfVectorsToMonoChannelExtractROINew.cxx | 8 +- ...gionNonUniformMultidimensionalSplitter.cxx | 30 +- ...nNonUniformMultidimensionalSplitterNew.cxx | 6 +- .../Common/otbImageRegionTileMapSplitter.cxx | 91 +++-- .../otbImageRegionTileMapSplitterNew.cxx | 6 +- .../Common/otbImageToImageListFilterNew.cxx | 11 +- .../otbImageToLineSpatialObjectListNew.cxx | 14 +- .../Code/Common/otbImageToPathFilterNew.cxx | 11 +- .../otbImageToVectorImageCastFilter.cxx | 15 +- .../otbImageToVectorImageCastFilterNew.cxx | 7 +- Testing/Code/Common/otbLabelMapSourceNew.cxx | 11 +- .../Common/otbLabelMapToGISTableFilter.cxx | 61 ++-- .../Common/otbLabelMapToGISTableFilterNew.cxx | 14 +- .../Common/otbLabelMapToVectorDataFilter.cxx | 105 +++--- .../otbLabelMapToVectorDataFilterNew.cxx | 12 +- .../Common/otbLabelObjectMapVectorizer.cxx | 109 +++--- .../otbLabelObjectToPolygonFunctorNew.cxx | 10 +- .../Code/Common/otbLineSpatialObjectList.cxx | 29 +- ...neSpatialObjectListToPointSetFilterNew.cxx | 12 +- .../Code/Common/otbLineSpatialObjectNew.cxx | 1 - .../Common/otbMirrorBoundaryConditionTest.cxx | 62 ++-- .../Code/Common/otbMultiChannelExtractROI.cxx | 224 ++++++------ .../Common/otbMultiChannelExtractROINew.cxx | 14 +- .../otbMultiToMonoChannelExtractROI.cxx | 324 ++++++++++++------ .../otbMultiToMonoChannelExtractROINew.cxx | 13 +- Testing/Code/Common/otbObjectList.cxx | 117 ++++--- Testing/Code/Common/otbObjectList2.cxx | 31 +- Testing/Code/Common/otbObjectListNew.cxx | 7 +- .../otbObjectListToObjectListFilterNew.cxx | 11 +- .../otbPathListToHistogramGenerator.cxx | 60 ++-- .../otbPathListToHistogramGeneratorNew.cxx | 11 +- .../Common/otbPathListToPathListFilterNew.cxx | 3 +- Testing/Code/Common/otbPointSetSourceTest.cxx | 33 +- .../Common/otbPolyLineImageConstIterator.cxx | 63 ++-- .../Code/Common/otbPolyLineImageIterator.cxx | 61 ++-- .../otbPolyLineParametricPathWithValueNew.cxx | 3 +- Testing/Code/Common/otbPolygon.cxx | 191 ++++++----- Testing/Code/Common/otbPolygonNew.cxx | 1 - ...GISConnectionImplementationConnectToDB.cxx | 9 +- ...ectionImplementationPerformTransaction.cxx | 16 +- .../Common/otbQuickLookImageGenerator.cxx | 13 +- .../Common/otbQuickLookImageGeneratorNew.cxx | 1 - ...RadiometricAttributesLabelMapFilterNew.cxx | 16 +- Testing/Code/Common/otbRectangle.cxx | 35 +- .../Code/Common/otbRemoteSensingRegion.cxx | 52 ++- .../Code/Common/otbRemoteSensingRegionNew.cxx | 14 +- .../otbShapeAttributesLabelMapFilterNew.cxx | 12 +- .../Code/Common/otbShiftScaleImageAdaptor.cxx | 30 +- .../Common/otbShiftScaleImageAdaptorNew.cxx | 12 +- .../Code/Common/otbSpatialObjectSourceNew.cxx | 3 +- .../Common/otbStandardFilterWatcherNew.cxx | 5 +- .../Code/Common/otbStandardWriterWatcher.cxx | 14 +- ...bStatisticsAttributesLabelMapFilterNew.cxx | 16 +- Testing/Code/Common/otbSystemTest.cxx | 42 +-- .../otbTestCommandLineArgumentParser.cxx | 30 +- .../otbTestCommandLineArgumentParserHelp.cxx | 25 +- .../otbTestCommandLineArgumentParserList.cxx | 46 ++- ...TestCommandLineArgumentParserWithError.cxx | 43 ++- .../Common/otbTestMultiExtractMultiUpdate.cxx | 18 +- ...otbUnaryFunctorNeighborhoodImageFilter.cxx | 29 +- ...UnaryFunctorNeighborhoodImageFilterNew.cxx | 21 +- ...nctorNeighborhoodWithOffsetImageFilter.cxx | 45 ++- ...orNeighborhoodWithOffsetImageFilterNew.cxx | 38 +- .../otbUnaryFunctorWithIndexImageFilter.cxx | 29 +- ...otbUnaryFunctorWithIndexImageFilterNew.cxx | 21 +- Testing/Code/Common/otbVectorData.cxx | 31 +- .../Code/Common/otbVectorDataExtractROI.cxx | 34 +- .../Common/otbVectorDataExtractROINew.cxx | 10 +- Testing/Code/Common/otbVectorDataNew.cxx | 2 +- .../Code/Common/otbVectorDataSourceNew.cxx | 6 +- .../Common/otbVectorDataToGISTableFilter.cxx | 48 ++- .../otbVectorDataToGISTableFilterNew.cxx | 15 +- .../Common/otbVectorDataToImageFilter.cxx | 28 +- .../Common/otbVectorDataToImageFilterNew.cxx | 7 +- .../otbVectorDataToImageFilterSensorModel.cxx | 31 +- .../otbVectorDataToImageFilterWorld.cxx | 30 +- .../Common/otbVectorDataToLabelMapFilter.cxx | 59 ++-- .../otbVectorDataToLabelMapFilterNew.cxx | 12 +- .../otbVectorDataToVectorDataFilterNew.cxx | 10 +- .../otbVectorImageToASImageAdaptorNew.cxx | 1 - ...esInterpolateDeformationFieldGenerator.cxx | 44 ++- ...nterpolateDeformationFieldGeneratorNew.cxx | 11 +- ...lateTransformDeformationFieldGenerator.cxx | 48 ++- ...eTransformDeformationFieldGeneratorNew.cxx | 11 +- ...enteredRigidDeformationFieldEstimation.cxx | 173 +++++----- .../otbDisparityMapEstimationMethod.cxx | 87 +++-- .../otbDisparityMapEstimationMethodNew.cxx | 15 +- .../otbEuler2DDeformationFieldEstimation.cxx | 171 ++++----- .../DisparityMap/otbNCCRegistrationFilter.cxx | 67 ++-- .../otbNCCRegistrationFilterNew.cxx | 18 +- ...arInterpolateDeformationFieldGenerator.cxx | 43 ++- ...nterpolateDeformationFieldGeneratorNew.cxx | 11 +- ...arInterpolateDeformationFieldGenerator.cxx | 48 ++- ...nterpolateDeformationFieldGeneratorNew.cxx | 11 +- ...bNearestPointDeformationFieldGenerator.cxx | 44 ++- ...arestPointDeformationFieldGeneratorNew.cxx | 10 +- ...restTransformDeformationFieldGenerator.cxx | 49 ++- ...tTransformDeformationFieldGeneratorNew.cxx | 11 +- ...PointSetToDeformationFieldGeneratorNew.cxx | 11 +- ...ransformToDeformationFieldGeneratorNew.cxx | 10 +- .../otbStreamingWarpImageFilter.cxx | 30 +- .../otbStreamingWarpImageFilterNew.cxx | 12 +- ...bTranslationDeformationFieldEstimation.cxx | 170 ++++----- .../otbAddCarvingPathFilterNew.cxx | 11 +- .../FeatureExtraction/otbAlignImageToPath.cxx | 71 ++-- .../otbAssociativeSymmetricalSum.cxx | 41 +-- .../otbAssociativeSymmetricalSumNew.cxx | 21 +- .../otbAssymmetricFusionOfLineDetector.cxx | 41 ++- .../otbAssymmetricFusionOfLineDetectorNew.cxx | 22 +- .../otbBreakAngularPathListFilter.cxx | 122 ++++--- .../otbBreakAngularPathListFilterNew.cxx | 3 +- .../otbCloudDetectionFilter.cxx | 26 +- .../otbCloudDetectionFilterNew.cxx | 8 +- .../otbCloudEstimatorDefaultFilter.cxx | 23 +- .../otbCloudEstimatorFilter.cxx | 26 +- .../otbCloudEstimatorFilterNew.cxx | 8 +- .../otbCompacityPathCircle.cxx | 50 ++- .../FeatureExtraction/otbCompacityPathNew.cxx | 12 +- .../otbCompacityPathRectangle.cxx | 61 ++-- .../otbCompacityPathSquare.cxx | 54 ++- .../otbComplexMomentImage.cxx | 34 +- .../otbComplexMomentPath.cxx | 39 +-- .../otbComplexMomentPathFloat.cxx | 40 +-- .../otbComplexMomentPathNew.cxx | 10 +- .../Code/FeatureExtraction/otbDrawPath.cxx | 68 ++-- .../FeatureExtraction/otbDrawPathAlign.cxx | 44 ++- .../FeatureExtraction/otbExtractSegments.cxx | 69 ++-- .../otbExtractSegmentsNew.cxx | 17 +- .../otbFeatureExtractionTests1.cxx | 23 +- .../otbFeatureExtractionTests10.cxx | 1 - .../otbFeatureExtractionTests11.cxx | 23 +- .../otbFeatureExtractionTests12.cxx | 5 +- .../otbFeatureExtractionTests13.cxx | 3 +- .../otbFeatureExtractionTests14.cxx | 21 +- .../otbFeatureExtractionTests15.cxx | 7 +- .../otbFeatureExtractionTests2.cxx | 1 - .../otbFeatureExtractionTests3.cxx | 1 - .../otbFeatureExtractionTests4.cxx | 1 - .../otbFeatureExtractionTests5.cxx | 1 - .../otbFeatureExtractionTests6.cxx | 1 - .../otbFeatureExtractionTests7.cxx | 1 - .../otbFeatureExtractionTests8.cxx | 1 - .../otbFeatureExtractionTests9.cxx | 1 - .../FeatureExtraction/otbFillGapsFilter.cxx | 65 ++-- .../otbFillGapsFilterNew.cxx | 4 +- .../FeatureExtraction/otbFlusserImage.cxx | 56 ++- .../Code/FeatureExtraction/otbFlusserPath.cxx | 49 ++- .../FeatureExtraction/otbFlusserPathNew.cxx | 12 +- .../otbFourierMellinImageFilter.cxx | 53 +-- .../otbFourierMellinImageFilterNew.cxx | 13 +- .../otbFourierMellinImageFilterTestFFT.cxx | 25 +- .../Code/FeatureExtraction/otbHarrisImage.cxx | 45 ++- .../FeatureExtraction/otbHarrisToPointSet.cxx | 65 ++-- .../otbHoughTransform2DLinesImageTest.cxx | 161 ++++----- Testing/Code/FeatureExtraction/otbHuImage.cxx | 56 ++- Testing/Code/FeatureExtraction/otbHuPath.cxx | 48 ++- .../Code/FeatureExtraction/otbHuPathNew.cxx | 14 +- .../otbImageFittingPolygonListFilter.cxx | 43 ++- .../otbImageFittingPolygonListFilterNew.cxx | 8 +- .../otbImageToCarvingPathFilterNew.cxx | 11 +- .../otbImageToEdgePathFilter.cxx | 60 ++-- .../otbImageToEdgePathFilterNew.cxx | 11 +- ...otbImageToFastSIFTKeyPointSetFilterNew.cxx | 10 +- ...KeyPointSetFilterOutputDescriptorAscii.cxx | 68 ++-- ...PointSetFilterOutputInterestPointAscii.cxx | 59 ++-- ...tbImageToHessianDeterminantImageFilter.cxx | 11 +- ...mageToHessianDeterminantImageFilterNew.cxx | 7 +- .../otbImageToLineSegmentVectorData.cxx | 30 +- .../otbImageToLineSegmentVectorDataNew.cxx | 19 +- ...mageToSIFTKeyPointSetFilterDistanceMap.cxx | 96 +++--- .../otbImageToSIFTKeyPointSetFilterNew.cxx | 10 +- ...mageToSIFTKeyPointSetFilterOutputAscii.cxx | 47 +-- ...KeyPointSetFilterOutputDescriptorAscii.cxx | 40 +-- ...mageToSIFTKeyPointSetFilterOutputImage.cxx | 72 ++-- ...PointSetFilterOutputInterestPointAscii.cxx | 35 +- .../otbImageToSURFKeyPointSetFilterNew.cxx | 10 +- ...KeyPointSetFilterOutputDescriptorAscii.cxx | 45 ++- ...PointSetFilterOutputInterestPointAscii.cxx | 40 +-- .../otbKeyPointSetsMatchingFilter.cxx | 54 +-- .../otbKeyPointSetsMatchingFilterNew.cxx | 6 +- .../Code/FeatureExtraction/otbLandmarkNew.cxx | 6 +- .../otbLikelihoodPathListFilter.cxx | 116 +++---- .../otbLikelihoodPathListFilterNew.cxx | 11 +- .../otbLineCorrelationDetector.cxx | 38 +- .../otbLineCorrelationDetectorLinear.cxx | 47 ++- .../otbLineCorrelationDetectorNew.cxx | 18 +- .../otbLineDetectorBaseNew.cxx | 18 +- .../otbLineRatioDetector.cxx | 37 +- .../otbLineRatioDetectorLinear.cxx | 48 ++- .../otbLineRatioDetectorNew.cxx | 18 +- .../otbLineSegmentDetector.cxx | 49 ++- .../otbLineSegmentDetectorNew.cxx | 21 +- ...alObjectListToRightAnglePointSetFilter.cxx | 82 ++--- ...tAnglePointSetFilterByStepsOutputAscii.cxx | 79 ++--- ...bjectListToRightAnglePointSetFilterNew.cxx | 31 +- .../otbLinkPathListFilter.cxx | 112 +++--- .../otbLinkPathListFilterNew.cxx | 3 +- .../Code/FeatureExtraction/otbLocalHough.cxx | 40 +-- .../FeatureExtraction/otbLocalHoughDraw.cxx | 51 ++- .../FeatureExtraction/otbLocalHoughNew.cxx | 16 +- .../otbModulusAndDirectionImageFiltersNew.cxx | 30 +- .../otbMultiplyByScalarImageTest.cxx | 56 ++- .../otbNeighborhoodScalarProductFilter.cxx | 25 +- .../otbNeighborhoodScalarProductFilterNew.cxx | 11 +- .../otbNonMaxRemovalByDirectionFilter.cxx | 11 +- .../otbNonMaxRemovalByDirectionFilterNew.cxx | 7 +- .../FeatureExtraction/otbOrientationPath.cxx | 36 +- .../otbOrientationPathNew.cxx | 12 +- .../otbPanTexTextureImageFilter.cxx | 17 +- .../otbPanTexTextureImageFilterNew.cxx | 8 +- .../otbPanTexTextureImageFunctionFilter.cxx | 17 +- ...otbPanTexTextureImageFunctionFilterNew.cxx | 8 +- .../otbParallelLinePathListFilter.cxx | 48 ++- .../otbParallelLinePathListFilterNew.cxx | 2 +- .../otbPixelSuppressionByDirection.cxx | 48 ++- .../otbPixelSuppressionByDirectionNew.cxx | 23 +- ...RegionImageToRectangularPathListFilter.cxx | 61 ++-- ...ionImageToRectangularPathListFilterNew.cxx | 17 +- .../otbRemoveCarvingPathFilterNew.cxx | 11 +- .../otbRemoveIsolatedByDirectionFilter.cxx | 10 +- .../otbRemoveIsolatedByDirectionFilterNew.cxx | 6 +- .../otbRemoveTortuousPathListFilter.cxx | 102 +++--- .../otbRemoveTortuousPathListFilterNew.cxx | 4 +- .../otbRemoveWrongDirectionFilter.cxx | 11 +- .../otbRemoveWrongDirectionFilterNew.cxx | 7 +- .../otbRoadExtractionFilter.cxx | 42 ++- .../otbRoadExtractionFilterNew.cxx | 5 +- .../otbSFSTexturesImageFilterNew.cxx | 10 +- .../otbSFSTexturesImageFilterTest.cxx | 40 +-- .../otbSimplePointCountStrategyTest.cxx | 35 +- .../otbSimplifyManyPathListFilter.cxx | 61 ++-- .../otbSimplifyPathListFilter.cxx | 102 +++--- .../otbSimplifyPathListFilterNew.cxx | 5 +- .../otbSqrtSpectralAngleImageFilter.cxx | 27 +- .../FeatureExtraction/otbTextureFunctor.cxx | 124 ++++--- .../otbTextureFunctorBase.cxx | 38 +- .../otbTextureImageFunction.cxx | 124 ++++--- .../otbThresholdImageToPointSetFilterNew.cxx | 11 +- .../otbThresholdImageToPointSetTest.cxx | 48 ++- .../otbTouziEdgeDetector.cxx | 34 +- .../otbTouziEdgeDetectorDirection.cxx | 34 +- .../otbTouziEdgeDetectorNew.cxx | 19 +- .../otbUrbanAreaDetectionImageFilter.cxx | 44 ++- .../otbUrbanAreaDetectionImageFilterNew.cxx | 14 +- .../otbVectorizationPathListFilter.cxx | 55 ++- .../otbVectorizationPathListFilterNew.cxx | 8 +- .../Code/Fusion/otbBayesianFusionFilter.cxx | 36 +- .../Fusion/otbBayesianFusionFilterNew.cxx | 23 +- Testing/Code/Fusion/otbFusionImageBaseNew.cxx | 38 +- Testing/Code/Fusion/otbFusionTests1.cxx | 2 - ...impleRcsPanSharpeningFusionImageFilter.cxx | 35 +- ...leRcsPanSharpeningFusionImageFilterNew.cxx | 13 +- ...bPostGISCreateTableTransactorAccessors.cxx | 17 +- .../otbPostGISCreateTableTransactorCreate.cxx | 19 +- Testing/Code/Gui/otbFltkFilterWatcher.cxx | 7 +- Testing/Code/Gui/otbFltkWriterWatcher.cxx | 18 +- Testing/Code/IO/otbBSQImageIOTestCanRead.cxx | 10 +- Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx | 10 +- Testing/Code/IO/otbCoordinateToNameTest.cxx | 18 +- Testing/Code/IO/otbDEMHandlerNew.cxx | 3 +- Testing/Code/IO/otbDEMHandlerTest.cxx | 26 +- Testing/Code/IO/otbDEMToImageGeneratorNew.cxx | 5 +- .../Code/IO/otbDEMToImageGeneratorTest.cxx | 19 +- .../IO/otbDEMToOrthoImageGeneratorNew.cxx | 3 +- .../IO/otbDEMToOrthoImageGeneratorTest.cxx | 30 +- .../otbDXFToSpatialObjectGroupFilterNew.cxx | 3 +- Testing/Code/IO/otbDoubleImageIOTest.cxx | 22 +- Testing/Code/IO/otbFloatImageIOTest.cxx | 22 +- .../IO/otbGDALDriverDoubleWritingTest.cxx | 10 +- Testing/Code/IO/otbGDALImageIOTestCanRead.cxx | 11 +- .../Code/IO/otbGDALImageIOTestCanWrite.cxx | 10 +- Testing/Code/IO/otbIOTests1.cxx | 2 - Testing/Code/IO/otbIOTests10.cxx | 2 - Testing/Code/IO/otbIOTests11.cxx | 2 - Testing/Code/IO/otbIOTests12.cxx | 24 +- Testing/Code/IO/otbIOTests13.cxx | 2 - Testing/Code/IO/otbIOTests14.cxx | 2 - Testing/Code/IO/otbIOTests15.cxx | 2 - Testing/Code/IO/otbIOTests16.cxx | 2 - Testing/Code/IO/otbIOTests17.cxx | 7 +- Testing/Code/IO/otbIOTests18.cxx | 19 +- Testing/Code/IO/otbIOTests19.cxx | 15 +- Testing/Code/IO/otbIOTests2.cxx | 2 - Testing/Code/IO/otbIOTests3.cxx | 2 - Testing/Code/IO/otbIOTests4.cxx | 2 - Testing/Code/IO/otbIOTests5.cxx | 2 - Testing/Code/IO/otbIOTests6.cxx | 2 - Testing/Code/IO/otbIOTests7.cxx | 2 - Testing/Code/IO/otbIOTests8.cxx | 2 - Testing/Code/IO/otbIOTests9.cxx | 2 - .../IO/otbIkonosImageMetadataInterfaceNew.cxx | 3 +- Testing/Code/IO/otbImageFileReaderERS.cxx | 45 ++- Testing/Code/IO/otbImageFileReaderMSTAR.cxx | 79 ++--- Testing/Code/IO/otbImageFileReaderONERA.cxx | 37 +- .../IO/otbImageFileReaderONERAComplex.cxx | 49 ++- Testing/Code/IO/otbImageFileReaderRADChar.cxx | 22 +- .../IO/otbImageFileReaderRADComplexDouble.cxx | 21 +- .../IO/otbImageFileReaderRADComplexFloat.cxx | 21 +- ...bImageFileReaderRADComplexFloatExtract.cxx | 34 +- .../IO/otbImageFileReaderRADComplexInt.cxx | 21 +- .../Code/IO/otbImageFileReaderRADFloat.cxx | 21 +- Testing/Code/IO/otbImageFileReaderRADInt.cxx | 21 +- Testing/Code/IO/otbImageFileReaderRGBTest.cxx | 24 +- .../Code/IO/otbImageFileReaderServerName.cxx | 27 +- Testing/Code/IO/otbImageFileReaderTest.cxx | 22 +- .../Code/IO/otbImageFileReaderTestFloat.cxx | 22 +- .../IO/otbImageFileWriterONERAComplex.cxx | 32 +- Testing/Code/IO/otbImageFileWriterRGBTest.cxx | 22 +- ...tbImageFileWriterStreamingONERAComplex.cxx | 18 +- Testing/Code/IO/otbImageFileWriterTest.cxx | 21 +- Testing/Code/IO/otbImageIOFactoryNew.cxx | 2 +- Testing/Code/IO/otbImageKeywordlist.cxx | 36 +- .../IO/otbImageMetadataFileWriterTest.cxx | 21 +- .../Code/IO/otbImageMetadataInterfaceTest.cxx | 65 ++-- .../IO/otbImageMetadataInterfaceTest2.cxx | 16 +- ...tbImageMetadataStreamingFileWriterTest.cxx | 21 +- Testing/Code/IO/otbImageSeriesFileReader.cxx | 34 +- Testing/Code/IO/otbImageTest.cxx | 61 ++-- Testing/Code/IO/otbIntImageIOTest.cxx | 22 +- .../Code/IO/otbJPEG2000ImageIOTestCanRead.cxx | 11 +- .../IO/otbJPEG2000ImageIOTestCanWrite.cxx | 11 +- Testing/Code/IO/otbKMLVectorDataIONew.cxx | 2 +- .../Code/IO/otbKMLVectorDataIOTestCanRead.cxx | 12 +- .../IO/otbKMLVectorDataIOTestCanWrite.cxx | 12 +- .../IO/otbKMLVectorDataIOTestFileReader.cxx | 26 +- Testing/Code/IO/otbLUMImageIOTestCanRead.cxx | 11 +- Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx | 11 +- .../Code/IO/otbMSTARImageIOTestCanRead.cxx | 10 +- Testing/Code/IO/otbMWImageIOTestCanRead.cxx | 11 +- Testing/Code/IO/otbMWImageIOTestCanWrite.cxx | 11 +- Testing/Code/IO/otbOGRVectorDataIOCanRead.cxx | 12 +- .../Code/IO/otbOGRVectorDataIOCanWrite.cxx | 12 +- Testing/Code/IO/otbOGRVectorDataIONew.cxx | 2 +- .../Code/IO/otbONERAImageIOTestCanRead.cxx | 10 +- Testing/Code/IO/otbOssimElevManagerTest.cxx | 66 ++-- Testing/Code/IO/otbOssimElevManagerTest2.cxx | 33 +- Testing/Code/IO/otbOssimElevManagerTest4.cxx | 87 +++-- .../IO/otbOssimJpegFileRessourceLeakTest.cxx | 14 +- Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx | 34 +- Testing/Code/IO/otbPipeline.cxx | 4 +- .../IO/otbPipelineMetadataHandlingTest.cxx | 22 +- ...pelineMetadataHandlingWithUFFilterTest.cxx | 23 +- Testing/Code/IO/otbPointSetFileReader.cxx | 14 +- Testing/Code/IO/otbPointSetFileReader2.cxx | 14 +- Testing/Code/IO/otbPointSetFileReaderNew.cxx | 3 +- .../Code/IO/otbPrepareSRTMDirectoryNew.cxx | 6 +- .../Code/IO/otbPrepareSRTMDirectoryTest.cxx | 15 +- .../otbQuickBirdImageMetadataInterfaceNew.cxx | 3 +- Testing/Code/IO/otbRADImageIOTestCanRead.cxx | 11 +- ...ReadingComplexDataIntoComplexImageTest.cxx | 34 +- Testing/Code/IO/otbShortImageIOTest.cxx | 22 +- Testing/Code/IO/otbShortRGBImageIOTest.cxx | 24 +- Testing/Code/IO/otbSpatialObjectDXFReader.cxx | 91 +++-- .../Code/IO/otbSpatialObjectDXFReaderNew.cxx | 2 +- .../IO/otbSpotImageMetadataInterfaceNew.cxx | 3 +- .../IO/otbStreamingImageFileWriterTest.cxx | 65 ++-- ...leWriterTestCalculateNumberOfDivisions.cxx | 72 ++-- ...StreamingImageFileWriterWithFilterTest.cxx | 61 ++-- .../Code/IO/otbStreamingImageFilterTest.cxx | 30 +- .../otbStreamingShortImageFileWriterTest.cxx | 58 ++-- ...leWriterTestCalculateNumberOfDivisions.cxx | 72 ++-- .../IO/otbTerraSarImageMetadataInterface.cxx | 131 ++++--- .../otbTerraSarImageMetadataInterfaceNew.cxx | 4 +- Testing/Code/IO/otbTileMapFetcherNew.cxx | 2 +- Testing/Code/IO/otbTileMapFetcherTest.cxx | 68 ++-- Testing/Code/IO/otbTileMapImageIOTest.cxx | 53 ++- Testing/Code/IO/otbTileMapImageSource.cxx | 44 +-- Testing/Code/IO/otbTileMapImageSourceNew.cxx | 4 +- Testing/Code/IO/otbTileMapWriter.cxx | 93 +++-- .../IO/otbVectorDataFileGeoReaderWriter.cxx | 9 +- Testing/Code/IO/otbVectorDataFileReader.cxx | 24 +- .../Code/IO/otbVectorDataFileReaderNew.cxx | 3 +- .../Code/IO/otbVectorDataFileReaderWriter.cxx | 7 +- Testing/Code/IO/otbVectorDataFileWriter.cxx | 31 +- .../Code/IO/otbVectorDataFileWriterNew.cxx | 4 +- .../IO/otbVectorDataFileWriterPolygons.cxx | 41 ++- Testing/Code/IO/otbVectorDataKeywordlist.cxx | 36 +- Testing/Code/IO/otbVectorDataSourceNew.cxx | 2 +- .../IO/otbVectorImageFileReaderWriterTest.cxx | 22 +- Testing/Code/IO/otbVectorImageTest.cxx | 61 ++-- ...WritingComplexDataWithComplexImageTest.cxx | 16 +- .../otbExhaustiveExponentialOptimizerNew.cxx | 5 +- .../otbKMeansImageClassificationFilter.cxx | 35 +- .../otbKMeansImageClassificationFilterNew.cxx | 8 +- Testing/Code/Learning/otbLearningTests1.cxx | 2 - Testing/Code/Learning/otbLearningTests2.cxx | 2 - Testing/Code/Learning/otbLearningTests3.cxx | 2 - Testing/Code/Learning/otbLearningTests4.cxx | 10 +- Testing/Code/Learning/otbPeriodicSOM.cxx | 55 ++- Testing/Code/Learning/otbPeriodicSOMNew.cxx | 13 +- .../Code/Learning/otbROIdataConversion.cxx | 37 +- .../Code/Learning/otbROIdataConversionNew.cxx | 12 +- Testing/Code/Learning/otbSEMClassifierNew.cxx | 22 +- Testing/Code/Learning/otbSOM.cxx | 56 ++- .../Code/Learning/otbSOMActivationBuilder.cxx | 35 +- .../Learning/otbSOMActivationBuilderNew.cxx | 19 +- Testing/Code/Learning/otbSOMClassifier.cxx | 59 ++-- Testing/Code/Learning/otbSOMClassifierNew.cxx | 23 +- .../otbSOMImageClassificationFilter.cxx | 17 +- .../otbSOMImageClassificationFilterNew.cxx | 10 +- Testing/Code/Learning/otbSOMMap.cxx | 24 +- Testing/Code/Learning/otbSOMMapNew.cxx | 8 +- Testing/Code/Learning/otbSOMNew.cxx | 11 +- .../Learning/otbSOMWithMissingValueNew.cxx | 29 +- .../Learning/otbSOMbasedImageFilterNew.cxx | 17 +- .../Code/Learning/otbSVMClassifierImage.cxx | 105 +++--- Testing/Code/Learning/otbSVMClassifierNew.cxx | 15 +- .../Learning/otbSVMClassifierPointSet.cxx | 69 ++-- .../otbSVMCrossValidationCostFunctionNew.cxx | 16 +- .../otbSVMImageClassificationFilter.cxx | 14 +- .../otbSVMImageClassificationFilterNew.cxx | 8 +- ...otbSVMImageModelEstimatorModelAccessor.cxx | 135 ++++---- .../Learning/otbSVMImageModelEstimatorNew.cxx | 22 +- .../otbSVMImageModelEstimatorTrain.cxx | 35 +- ...otbSVMImageModelEstimatorTrainOneClass.cxx | 34 +- ...leKernelFunctorImageClassificationTest.cxx | 44 +-- ...leKernelFunctorImageModelEstimatorTest.cxx | 42 +-- Testing/Code/Learning/otbSVMModelAccessor.cxx | 104 +++--- .../otbSVMModelCopyComposedKernelTest.cxx | 11 +- .../otbSVMModelCopyGenericKernelTest.cxx | 13 +- Testing/Code/Learning/otbSVMModelCopyTest.cxx | 16 +- .../otbSVMModelGenericKernelLoadSave.cxx | 23 +- .../otbSVMModelGenericKernelsTest.cxx | 31 +- Testing/Code/Learning/otbSVMModelLoad.cxx | 17 +- Testing/Code/Learning/otbSVMModelLoadSave.cxx | 17 +- Testing/Code/Learning/otbSVMModelNew.cxx | 17 +- .../otbSVMPointSetModelEstimatorNew.cxx | 22 +- .../otbSVMPointSetModelEstimatorTrain.cxx | 51 ++- .../Code/Markov/otbMRFEnergyEdgeFidelity.cxx | 13 +- .../Markov/otbMRFEnergyEdgeFidelityNew.cxx | 11 +- Testing/Code/Markov/otbMRFEnergyGaussian.cxx | 30 +- .../otbMRFEnergyGaussianClassification.cxx | 16 +- .../otbMRFEnergyGaussianClassificationNew.cxx | 6 +- .../Code/Markov/otbMRFEnergyGaussianNew.cxx | 8 +- Testing/Code/Markov/otbMRFEnergyPotts.cxx | 20 +- Testing/Code/Markov/otbMRFEnergyPottsNew.cxx | 8 +- Testing/Code/Markov/otbMRFOptimizerICM.cxx | 8 +- Testing/Code/Markov/otbMRFOptimizerICMNew.cxx | 3 +- .../Code/Markov/otbMRFOptimizerMetropolis.cxx | 7 +- .../Markov/otbMRFOptimizerMetropolisNew.cxx | 1 - Testing/Code/Markov/otbMRFSamplerMAP.cxx | 41 +-- Testing/Code/Markov/otbMRFSamplerMAPNew.cxx | 8 +- Testing/Code/Markov/otbMRFSamplerRandom.cxx | 46 +-- .../Code/Markov/otbMRFSamplerRandomMAP.cxx | 55 ++- .../Code/Markov/otbMRFSamplerRandomMAPNew.cxx | 9 +- .../Code/Markov/otbMRFSamplerRandomNew.cxx | 8 +- .../Markov/otbMarkovRandomFieldFilter.cxx | 49 ++- .../Markov/otbMarkovRandomFieldFilterNew.cxx | 9 +- Testing/Code/Markov/otbMarkovTests1.cxx | 2 - Testing/Code/Markov/otbMarkovTests2.cxx | 1 - ...otbConvexOrConcaveClassificationFilter.cxx | 16 +- ...ConvexOrConcaveClassificationFilterNew.cxx | 6 +- ...esicMorphologyDecompositionImageFilter.cxx | 21 +- ...cMorphologyDecompositionImageFilterNew.cxx | 9 +- ...ologyIterativeDecompositionImageFilter.cxx | 42 +-- ...gyIterativeDecompositionImageFilterNew.cxx | 8 +- .../otbGeodesicMorphologyLevelingFilter.cxx | 11 +- ...otbGeodesicMorphologyLevelingFilterNew.cxx | 4 +- .../otbMorphologicalClosingProfileFilter.cxx | 27 +- ...tbMorphologicalClosingProfileFilterNew.cxx | 8 +- .../otbMorphologicalOpeningProfileFilter.cxx | 27 +- ...tbMorphologicalOpeningProfileFilterNew.cxx | 8 +- .../otbMorphologicalPyramidAnalysisFilter.cxx | 51 ++- ...bMorphologicalPyramidAnalysisFilterNew.cxx | 14 +- ...otbMorphologicalPyramidMRToMSConverter.cxx | 26 +- ...MorphologicalPyramidMRToMSConverterNew.cxx | 7 +- .../otbMorphologicalPyramidResampler.cxx | 16 +- .../otbMorphologicalPyramidResamplerNew.cxx | 7 +- ...MorphologicalPyramidSegmentationFilter.cxx | 45 ++- ...phologicalPyramidSegmentationFilterNew.cxx | 9 +- .../otbMorphologicalPyramidSegmenter.cxx | 22 +- .../otbMorphologicalPyramidSegmenterNew.cxx | 9 +- ...otbMorphologicalPyramidSynthesisFilter.cxx | 21 +- ...MorphologicalPyramidSynthesisFilterNew.cxx | 7 +- ...aleConvexOrConcaveClassificationFilter.cxx | 35 +- ...ConvexOrConcaveClassificationFilterNew.cxx | 13 +- ...ativeToMultiScaleCharacteristicsFilter.cxx | 32 +- ...veToMultiScaleCharacteristicsFilterNew.cxx | 12 +- .../otbProfileToProfileDerivativeFilter.cxx | 29 +- ...otbProfileToProfileDerivativeFilterNew.cxx | 6 +- .../MultiScale/otbSubsampleImageFilter.cxx | 39 +-- .../MultiScale/otbSubsampleImageFilterNew.cxx | 11 +- .../Code/MultiScale/otbWaveletFilterBank.cxx | 44 ++- .../MultiScale/otbWaveletFilterBankNew.cxx | 11 +- .../otbWaveletInverseFilterBankNew.cxx | 11 +- .../otbWaveletInverseTransformNew.cxx | 19 +- .../Code/MultiScale/otbWaveletOperator.cxx | 11 +- .../Code/MultiScale/otbWaveletOperatorNew.cxx | 9 +- .../otbWaveletPacketInverseTransformNew.cxx | 19 +- .../MultiScale/otbWaveletPacketTransform.cxx | 64 ++-- .../otbWaveletPacketTransformNew.cxx | 24 +- .../Code/MultiScale/otbWaveletTransform.cxx | 58 ++-- .../MultiScale/otbWaveletTransformNew.cxx | 17 +- .../Projections/otbCompositeTransform.cxx | 33 +- .../Projections/otbCompositeTransformNew.cxx | 10 +- .../otbCreateInverseForwardSensorModel.cxx | 21 +- .../otbCreateProjectionWithOSSIM.cxx | 47 ++- .../otbCreateProjectionWithOTB.cxx | 46 ++- .../otbGCPsToRPCSensorModelImageFilterNew.cxx | 5 +- ...sToRPCSensorModelImageFilterWithoutDEM.cxx | 38 +- .../Projections/otbGenericMapProjection.cxx | 17 +- .../otbGenericMapProjectionNew.cxx | 6 +- .../Projections/otbGenericRSTransform.cxx | 83 ++--- .../Projections/otbGenericRSTransformNew.cxx | 6 +- .../Projections/otbGeocentricTransform.cxx | 24 +- .../Projections/otbGeocentricTransformNew.cxx | 3 +- ...otbLeastSquareAffineTransformEstimator.cxx | 55 ++- ...LeastSquareAffineTransformEstimatorNew.cxx | 5 +- Testing/Code/Projections/otbMapProjection.cxx | 6 +- .../Code/Projections/otbMapProjectionsNew.cxx | 138 ++++---- .../otbOrthoRectificationFilter.cxx | 48 ++- .../otbOrthoRectificationFilterNew.cxx | 10 +- .../otbOrthoRectificationFilterWithDEM.cxx | 51 ++- .../otbOrthoRectificationMonoThreadFilter.cxx | 51 ++- .../Code/Projections/otbProjectionBaseNew.cxx | 10 +- .../Code/Projections/otbProjectionsTests1.cxx | 1 - .../Code/Projections/otbProjectionsTests2.cxx | 1 - .../Code/Projections/otbProjectionsTests3.cxx | 1 - .../otbRegionProjectionResampler.cxx | 82 +++-- Testing/Code/Projections/otbSensorModel.cxx | 16 +- .../Code/Projections/otbSensorModelsNew.cxx | 5 +- .../Code/Projections/otbTileMapTransform.cxx | 16 +- .../otbVectorDataExtractROIandProjection.cxx | 27 +- .../otbVectorDataProjectionFilter.cxx | 29 +- ...VectorDataProjectionFilterFromMapToGeo.cxx | 19 +- ...ctorDataProjectionFilterFromMapToImage.cxx | 19 +- ...torDataProjectionFilterFromMapToSensor.cxx | 23 +- .../otbVectorDataProjectionFilterNew.cxx | 10 +- ...lRAndGAndNIRVegetationIndexImageFilter.cxx | 41 +-- ...IRAndGAndNIRVegetationIndexImageFilter.cxx | 79 ++--- .../Code/Radiometry/otbAeronetExtractData.cxx | 42 +-- .../otbAeronetExtractDataBadData.cxx | 12 +- Testing/Code/Radiometry/otbAeronetNew.cxx | 2 +- .../otbAtmosphericCorrectionParametersNew.cxx | 6 +- ...arametersTo6SAtmosphericRadiativeTerms.cxx | 161 +++++---- ...metersTo6SAtmosphericRadiativeTermsNew.cxx | 6 +- .../otbAtmosphericCorrectionSequencement.cxx | 107 +++--- .../otbAtmosphericRadiativeTermsNew.cxx | 2 +- .../otbDEMCaracteristicsExtractor.cxx | 20 +- .../otbDEMCaracteristicsExtractorNew.cxx | 7 +- ...lRAndBAndNIRVegetationIndexImageFilter.cxx | 39 ++- ...IRAndBAndNIRVegetationIndexImageFilter.cxx | 62 ++-- .../Radiometry/otbFilterFunctionValues.cxx | 40 +-- .../Radiometry/otbGAndRIndexImageFilter.cxx | 60 ++-- .../otbGAndRIndexImageFilterNew.cxx | 10 +- .../otbIBGAndRAndNIRIndexImageFilter.cxx | 70 ++-- ...ultiChannelGAndRAndNIRIndexImageFilter.cxx | 35 +- ...ISUMultiChannelRAndNIRIndexImageFilter.cxx | 37 +- .../otbISURAndNIRIndexImageFilter.cxx | 56 ++- .../otbImageToLuminanceImageFilter.cxx | 27 +- .../otbImageToLuminanceImageFilterAuto.cxx | 17 +- .../otbImageToLuminanceImageFilterNew.cxx | 7 +- .../otbImageToReflectanceImageFilter.cxx | 55 ++- .../otbImageToReflectanceImageFilterAuto.cxx | 18 +- .../otbImageToReflectanceImageFilterNew.cxx | 7 +- .../otbLuminanceToReflectanceImageFilter.cxx | 43 ++- ...bLuminanceToReflectanceImageFilterAuto.cxx | 19 +- ...tbLuminanceToReflectanceImageFilterNew.cxx | 8 +- .../otbMultiChannelGAndRIndexImageFilter.cxx | 53 +-- ...tbMultiChannelGAndRIndexImageFilterNew.cxx | 6 +- ...lRAndBAndNIRVegetationIndexImageFilter.cxx | 41 ++- ...ndBAndNIRVegetationIndexImageFilterNew.cxx | 9 +- ...iChannelRAndGAndNIRIndexImageFilterNew.cxx | 9 +- ...annelRAndNIRVegetationIndexImageFilter.cxx | 121 ++++--- ...elRAndNIRVegetationIndexImageFilterNew.cxx | 7 +- ...IMultiChannelTM4AndTM5IndexImageFilter.cxx | 31 +- .../otbNDBITM4AndTM5IndexImageFilter.cxx | 52 ++- ...bNDWIMultiChannelWaterIndexImageFilter.cxx | 31 +- .../otbNDWIWaterIndexImageFilter.cxx | 52 ++- ...bRAndBAndNIRVegetationIndexImageFilter.cxx | 58 ++-- ...ndBAndNIRVegetationIndexImageFilterNew.cxx | 14 +- ...ndGAndNIRVegetationIndexImageFilterNew.cxx | 14 +- .../otbRAndNIRVegetationIndexImageFilter.cxx | 130 +++---- ...tbRAndNIRVegetationIndexImageFilterNew.cxx | 10 +- .../Code/Radiometry/otbRadiometryTests1.cxx | 2 - .../Code/Radiometry/otbRadiometryTests2.cxx | 2 - .../Code/Radiometry/otbRadiometryTests3.cxx | 2 - .../Code/Radiometry/otbRadiometryTests4.cxx | 2 - .../Code/Radiometry/otbRadiometryTests5.cxx | 2 - .../Code/Radiometry/otbRadiometryTests6.cxx | 2 - .../Code/Radiometry/otbRadiometryTests7.cxx | 2 - .../Code/Radiometry/otbRadiometryTests8.cxx | 3 - .../Code/Radiometry/otbRadiometryTests9.cxx | 19 +- ...ectanceToSurfaceReflectanceImageFilter.cxx | 32 +- ...anceToSurfaceReflectanceImageFilterNew.cxx | 9 +- ...ToRomaniaSurfaceReflectanceImageFilter.cxx | 112 +++--- ...SIXSTraitsComputeAtmosphericParameters.cxx | 160 ++++----- ...annelRAndNIRVegetationIndexImageFilter.cxx | 32 +- ...ASetBRAndNIRVegetationIndexImageFilter.cxx | 42 +-- ...eAdjencyEffect6SCorrectionSchemeFilter.cxx | 114 +++--- ...jencyEffect6SCorrectionSchemeFilterNew.cxx | 12 +- ...lRAndBAndNIRVegetationIndexImageFilter.cxx | 43 ++- ...IRAndBAndNIRVegetationIndexImageFilter.cxx | 80 ++--- .../otbTerraSarBrightnessFunctor.cxx | 13 +- ...rraSarBrightnessImageComplexFilterTest.cxx | 36 +- .../otbTerraSarBrightnessImageFilterNew.cxx | 7 +- .../otbTerraSarBrightnessImageFilterTest.cxx | 32 +- .../otbTerraSarCalibrationFunctor.cxx | 8 +- ...raSarCalibrationImageComplexFilterTest.cxx | 18 +- .../otbTerraSarCalibrationImageFilterNew.cxx | 10 +- .../otbTerraSarCalibrationImageFilterTest.cxx | 20 +- ...annelRAndNIRVegetationIndexImageFilter.cxx | 35 +- ...bWDVIRAndNIRVegetationIndexImageFilter.cxx | 54 ++- .../otbWaterSqrtSpectralAngleImageFilter.cxx | 24 +- .../otbHHnHVPolarimetricSynthesisFilter.cxx | 53 ++- ...otbHHnHVnVVPolarimetricSynthesisFilter.cxx | 57 ++- ...ltiChannelsPolarimetricSynthesisFilter.cxx | 80 +++-- ...ChannelsPolarimetricSynthesisFilterNew.cxx | 16 +- .../otbPolarimetricSynthesisFilter.cxx | 61 ++-- .../otbPolarimetricSynthesisFilterNew.cxx | 15 +- .../otbSARPolarimetryTests1.cxx | 2 - .../otbVHnVVPolarimetricSynthesisFilter.cxx | 54 ++- ...ltiChannelsPolarimetricSynthesisFilter.cxx | 52 ++- .../otbImageListToRCC8GraphFilterNew.cxx | 13 +- ...mageMultiSegmentationToRCC8GraphFilter.cxx | 35 +- ...eMultiSegmentationToRCC8GraphFilterNew.cxx | 13 +- .../otbImageToImageRCC8Calculator.cxx | 84 ++--- .../otbPolygonListToRCC8GraphFilter.cxx | 45 ++- .../otbPolygonListToRCC8GraphFilterNew.cxx | 8 +- .../otbPolygonToPolygonRCC8Calculator.cxx | 110 +++--- .../otbPolygonToPolygonRCC8CalculatorNew.cxx | 3 +- Testing/Code/SpatialReasoning/otbRCC8Edge.cxx | 13 +- .../Code/SpatialReasoning/otbRCC8EdgeNew.cxx | 3 +- .../Code/SpatialReasoning/otbRCC8Graph.cxx | 111 +++--- .../otbRCC8GraphFileReader.cxx | 67 ++-- .../otbRCC8GraphFileReaderNew.cxx | 6 +- .../otbRCC8GraphFileWriter.cxx | 44 ++- .../otbRCC8GraphFileWriterNew.cxx | 7 +- .../otbRCC8GraphIOEndToEnd.cxx | 6 +- .../Code/SpatialReasoning/otbRCC8GraphNew.cxx | 4 +- .../otbRCC8GraphSourceNew.cxx | 6 +- .../SpatialReasoning/otbRCC8VertexBase.cxx | 71 ++-- .../SpatialReasoning/otbRCC8VertexBaseNew.cxx | 4 +- .../otbRCC8VertexWithCompacity.cxx | 93 +++-- .../otbRCC8VertexWithCompacityNew.cxx | 8 +- .../Code/TestSystem/otbCompareAsciiTests.cxx | 7 +- .../Code/TestSystem/otbCompareAsciiTests2.cxx | 7 +- .../Code/TestSystem/otbCompareAsciiTests3.cxx | 7 +- .../Code/TestSystem/otbCompareAsciiTests4.cxx | 7 +- .../Code/TestSystem/otbCompareAsciiTests5.cxx | 7 +- .../Visu/otbDoubleImageViewerWithLink.cxx | 14 +- .../Code/Visu/otbFixedSizeFullImageWidget.cxx | 54 ++- .../Visu/otbFixedSizeFullImageWidgetNew.cxx | 5 +- .../Visu/otbFullResolutionImageWidget.cxx | 54 ++- .../Visu/otbFullResolutionImageWidgetNew.cxx | 5 +- .../otbHistogramAndTransferFunctionWidget.cxx | 20 +- ...bHistogramAndTransferFunctionWidgetNew.cxx | 8 +- ...otbImageToGrayscaleAnaglyphImageFilter.cxx | 11 +- ...ImageToGrayscaleAnaglyphImageFilterNew.cxx | 6 +- Testing/Code/Visu/otbImageViewer.cxx | 13 +- Testing/Code/Visu/otbImageViewerNew.cxx | 8 +- .../otbImageViewerWithMultiBandFilter.cxx | 23 +- .../Code/Visu/otbImageViewerWithOtbImage.cxx | 11 +- .../Code/Visu/otbImageViewerWithOverlay.cxx | 44 ++- Testing/Code/Visu/otbImageWidgetBaseNew.cxx | 5 +- .../Code/Visu/otbImageWidgetPolygonForm.cxx | 57 ++- .../Visu/otbImageWidgetPolygonFormNew.cxx | 6 +- .../Visu/otbImageWidgetTransferFunctions.cxx | 46 +-- .../otbImageWidgetTransferFunctionsNew.cxx | 14 +- ...rImageToColorAnaglyphVectorImageFilter.cxx | 12 +- ...ageToColorAnaglyphVectorImageFilterNew.cxx | 6 +- Testing/Code/Visu/otbVisuTests2.cxx | 26 +- Testing/Code/Visu/otbZoomableImageWidget.cxx | 47 ++- .../Code/Visu/otbZoomableImageWidgetNew.cxx | 21 +- .../Visualization/otbBlendingImageFilter.cxx | 4 +- .../otbBlendingImageFilterNew.cxx | 8 +- .../Code/Visualization/otbCurves2DWidget.cxx | 34 +- .../Visualization/otbCurves2DWidgetNew.cxx | 4 +- .../otbCurves2DWidgetWithHistogram.cxx | 48 +-- .../Visualization/otbHistogramCurveNew.cxx | 12 +- .../otbImageLayerGeneratorNew.cxx | 10 +- .../otbImageLayerGeneratorScalar.cxx | 16 +- .../otbImageLayerGeneratorVector.cxx | 16 +- .../Code/Visualization/otbImageLayerNew.cxx | 8 +- .../otbImageLayerRenderingModelNew.cxx | 6 +- ...otbImageLayerRenderingModelSingleLayer.cxx | 51 ++- .../Visualization/otbImageLayerScalar.cxx | 47 ++- .../Visualization/otbImageLayerVector.cxx | 67 ++-- .../Code/Visualization/otbImageViewNew.cxx | 8 +- .../otbImageViewerEndToEndSingleLayer.cxx | 85 +++-- ...dToEndSingleLayerWithSelectAreaHandler.cxx | 96 +++--- .../otbImageViewerEndToEndTwoLayers.cxx | 99 +++--- .../otbImageViewerEndToEndWithVectorData.cxx | 101 +++--- Testing/Code/Visualization/otbImageWidget.cxx | 44 +-- .../otbImageWidgetActionHandlerNew.cxx | 2 +- .../otbImageWidgetController.cxx | 8 +- .../otbImageWidgetControllerNew.cxx | 2 +- .../Code/Visualization/otbImageWidgetNew.cxx | 4 +- ...tbImageWidgetWithVectorDataGlComponent.cxx | 87 +++-- .../Visualization/otbLayerBasedModelNew.cxx | 10 +- .../otbMultiplyBlendingFunctionNew.cxx | 4 +- .../otbPackedWidgetManagerNew.cxx | 4 +- .../otbPixelDescriptionModelNew.cxx | 4 +- .../otbPixelDescriptionModelSingleLayer.cxx | 26 +- .../otbRenderingImageFilterAmplitude.cxx | 52 ++- .../otbRenderingImageFilterNew.cxx | 12 +- .../otbRenderingImageFilterPhase.cxx | 52 ++- .../otbRenderingImageFilterScalar.cxx | 19 +- .../otbRenderingImageFilterVector.cxx | 50 ++- ...ageFilterVectorWithExpNegativeTransfer.cxx | 48 ++- .../otbSplittedWidgetManagerNew.cxx | 4 +- .../Visualization/otbStandardImageViewer.cxx | 28 +- .../otbStandardImageViewerNew.cxx | 4 +- .../otbStandardImageViewerRGBNew.cxx | 2 +- .../otbStandardRenderingFunctionNew.cxx | 4 +- .../otbUniformAlphaBlendingFunctionNew.cxx | 4 +- .../otbVectorDataGlComponentNew.cxx | 2 +- .../Visualization/otbVectorDataModelNew.cxx | 2 +- .../otbVerticalAsymptoteCurveNew.cxx | 4 +- .../Visualization/otbVisualizationTests1.cxx | 1 - Testing/Fa/0000041-mean_shift.cxx | 46 ++- Testing/Fa/0000132-jpg.cxx | 12 +- Testing/Fa/00134-feature_extraction.cxx | 61 ++-- Testing/Fa/AlignementsQB.cxx | 59 ++-- Testing/Fa/MapActivation.cxx | 87 +++-- Testing/Fa/PolygonsVectorization.cxx | 244 ++++++------- Testing/Fa/StreamingStat.cxx | 20 +- 932 files changed, 12463 insertions(+), 13708 deletions(-) diff --git a/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.cxx b/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.cxx index f22eb417a6..eaa2134368 100644 --- a/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.cxx +++ b/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.cxx @@ -24,7 +24,6 @@ #define ITK_LEAN_AND_MEAN #endif - #include "otbImage.h" #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" @@ -37,16 +36,16 @@ int otbAmplitudePhaseToRGBFunctor(int argc, char * argv[]) { - typedef float PixelType; + typedef float PixelType; typedef otb::Image<PixelType, 2> ImageType; - typedef std::complex<PixelType> ComplexPixelType; + typedef std::complex<PixelType> ComplexPixelType; typedef otb::Image<ComplexPixelType, 2> ComplexImageType; typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType, 2> RGBImageType; + typedef otb::Image<RGBPixelType, 2> RGBImageType; - typedef otb::ImageFileReader<ComplexImageType> ReaderType; + typedef otb::ImageFileReader<ComplexImageType> ReaderType; typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); @@ -54,13 +53,11 @@ int otbAmplitudePhaseToRGBFunctor(int argc, char * argv[]) reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); - - typedef itk::ComplexToModulusImageFilter<ComplexImageType,ImageType> ModulusFilterType; + typedef itk::ComplexToModulusImageFilter<ComplexImageType, ImageType> ModulusFilterType; ModulusFilterType::Pointer modulusFilter = ModulusFilterType::New(); modulusFilter->SetInput(reader->GetOutput()); - - typedef itk::ComplexToPhaseImageFilter<ComplexImageType,ImageType> PhaseFilterType; + typedef itk::ComplexToPhaseImageFilter<ComplexImageType, ImageType> PhaseFilterType; PhaseFilterType::Pointer phaseFilter = PhaseFilterType::New(); phaseFilter->SetInput(reader->GetOutput()); @@ -70,14 +67,13 @@ int otbAmplitudePhaseToRGBFunctor(int argc, char * argv[]) constFilter->SetInput(modulusFilter->GetOutput()); typedef otb::Functor::AmplitudePhaseToRGBFunctor - <PixelType,PixelType,PixelType,RGBPixelType> ColorMapFunctorType; + <PixelType, PixelType, PixelType, RGBPixelType> ColorMapFunctorType; typedef itk::TernaryFunctorImageFilter - <ImageType, ImageType, ImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType; + <ImageType, ImageType, ImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType; ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->GetFunctor().SetMaximum(4000); colormapper->GetFunctor().SetMinimum(0); - colormapper->SetInput1(modulusFilter->GetOutput()); colormapper->SetInput2(constFilter->GetOutput()); colormapper->SetInput3(phaseFilter->GetOutput()); @@ -87,6 +83,5 @@ int otbAmplitudePhaseToRGBFunctor(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctorNew.cxx b/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctorNew.cxx index 7e92673366..88ba193a2a 100644 --- a/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctorNew.cxx +++ b/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctorNew.cxx @@ -24,7 +24,6 @@ #define ITK_LEAN_AND_MEAN #endif - #include "otbImage.h" #include "itkTernaryFunctorImageFilter.h" @@ -33,20 +32,19 @@ int otbAmplitudePhaseToRGBFunctorNew(int argc, char * argv[]) { - typedef double PixelType; + typedef double PixelType; typedef otb::Image<PixelType, 2> ImageType; typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType, 2> RGBImageType; + typedef otb::Image<RGBPixelType, 2> RGBImageType; typedef otb::Functor::AmplitudePhaseToRGBFunctor - <PixelType,PixelType,PixelType,RGBPixelType> ColorMapFunctorType; + <PixelType, PixelType, PixelType, RGBPixelType> ColorMapFunctorType; typedef itk::TernaryFunctorImageFilter - <ImageType, ImageType, ImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType; + <ImageType, ImageType, ImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType; ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->GetFunctor().SetMaximum(150); colormapper->GetFunctor().SetMinimum(70); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilter.cxx b/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilter.cxx index c5de19449a..32e514a3be 100644 --- a/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilter.cxx @@ -27,10 +27,10 @@ int otbBSplineDecompositionImageFilter(int argc, char * argv[]) const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<double,2> ImageType; - typedef otb::BSplineDecompositionImageFilter<ImageType,ImageType> BSplineDecompositionImageFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::Image<double, 2> ImageType; + typedef otb::BSplineDecompositionImageFilter<ImageType, ImageType> BSplineDecompositionImageFilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; // Instantiating object BSplineDecompositionImageFilterType::Pointer filter = BSplineDecompositionImageFilterType::New(); diff --git a/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilterNew.cxx b/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilterNew.cxx index fae84a4ef0..2106904dd8 100644 --- a/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilterNew.cxx @@ -22,8 +22,8 @@ int otbBSplineDecompositionImageFilterNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::BSplineDecompositionImageFilter<ImageType,ImageType> BSplineDecompositionImageFilterType; + typedef otb::Image<double, 2> ImageType; + typedef otb::BSplineDecompositionImageFilter<ImageType, ImageType> BSplineDecompositionImageFilterType; // Instantiating object BSplineDecompositionImageFilterType::Pointer filter = BSplineDecompositionImageFilterType::New(); diff --git a/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunction.cxx b/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunction.cxx index 4cc08820bf..5497319b0d 100644 --- a/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunction.cxx +++ b/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunction.cxx @@ -27,26 +27,26 @@ int otbBSplineInterpolateImageFunction(int argc, char * argv[]) const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<double,2> ImageType; - typedef otb::BSplineInterpolateImageFunction<ImageType,double,double> InterpolatorType; - typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<double, 2> ImageType; + typedef otb::BSplineInterpolateImageFunction<ImageType, double, double> InterpolatorType; + typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; + typedef otb::ImageFileReader<ImageType> ReaderType; int i = 3; std::vector<ContinuousIndexType> indicesList; - while (i<argc && (i+1)<argc) - { + while (i < argc && (i + 1) < argc) + { ContinuousIndexType idx; - idx[0]=atof(argv[i]); - idx[1]=atof(argv[i+1]); + idx[0] = atof(argv[i]); + idx[1] = atof(argv[i + 1]); indicesList.push_back(idx); - i+=2; - } + i += 2; + } // Instantiating object InterpolatorType::Pointer interpolator = InterpolatorType::New(); @@ -60,10 +60,10 @@ int otbBSplineInterpolateImageFunction(int argc, char * argv[]) std::ofstream file; file.open(outfname); - for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it) - { - file<<(*it)<<" -> "<<interpolator->EvaluateAtContinuousIndex((*it))<<std::endl; - } + for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin(); it != indicesList.end(); ++it) + { + file << (*it) << " -> " << interpolator->EvaluateAtContinuousIndex((*it)) << std::endl; + } file.close(); diff --git a/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunctionNew.cxx b/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunctionNew.cxx index a9839082b7..701675e575 100644 --- a/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunctionNew.cxx @@ -22,8 +22,8 @@ int otbBSplineInterpolateImageFunctionNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::BSplineInterpolateImageFunction<ImageType,double,double> InterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::BSplineInterpolateImageFunction<ImageType, double, double> InterpolatorType; // Instantiating object InterpolatorType::Pointer filter = InterpolatorType::New(); diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests10.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests10.cxx index 78e4540a92..b874bb3989 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests10.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests10.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx index 760c1c5847..93ee5440c7 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests12.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests12.cxx index 0113ff67aa..9b8d2c93fa 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests12.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests12.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests2.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests2.cxx index a32473092c..ef0db694e1 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests2.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests2.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests3.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests3.cxx index 6256ee8892..f89241bc82 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests3.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests3.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests4.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests4.cxx index ec0d5bfc52..a0eaa549fe 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests4.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests4.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests5.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests5.cxx index 31fdd53aa3..a9105d5111 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests5.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests5.cxx @@ -22,22 +22,21 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbStreamingResampleImageFilterNew); -REGISTER_TEST(otbStreamingResampleImageFilter); -REGISTER_TEST(otbStreamingResampleImageFilterCompareWithITK); -REGISTER_TEST(otbResampleSLCImage); -REGISTER_TEST(otbStreamingStatisticsVectorImageFilterNew); -REGISTER_TEST(otbStreamingStatisticsVectorImageFilter); -REGISTER_TEST(otbMatrixTransposeMatrixImageFilterNew); -REGISTER_TEST(otbMatrixTransposeMatrixImageFilter); -REGISTER_TEST(otbUnaryImageFunctorWithVectorImageFilterNew); -REGISTER_TEST(otbUnaryImageFunctorWithVectorImageFilter); -REGISTER_TEST(otbPrintableImageFilterNew); -REGISTER_TEST(otbPrintableImageFilter); -REGISTER_TEST(otbPrintableImageFilterWithMask); + REGISTER_TEST(otbStreamingResampleImageFilterNew); + REGISTER_TEST(otbStreamingResampleImageFilter); + REGISTER_TEST(otbStreamingResampleImageFilterCompareWithITK); + REGISTER_TEST(otbResampleSLCImage); + REGISTER_TEST(otbStreamingStatisticsVectorImageFilterNew); + REGISTER_TEST(otbStreamingStatisticsVectorImageFilter); + REGISTER_TEST(otbMatrixTransposeMatrixImageFilterNew); + REGISTER_TEST(otbMatrixTransposeMatrixImageFilter); + REGISTER_TEST(otbUnaryImageFunctorWithVectorImageFilterNew); + REGISTER_TEST(otbUnaryImageFunctorWithVectorImageFilter); + REGISTER_TEST(otbPrintableImageFilterNew); + REGISTER_TEST(otbPrintableImageFilter); + REGISTER_TEST(otbPrintableImageFilterWithMask); } diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests6.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests6.cxx index 07f49b3369..bd0cd5acc3 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests6.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests6.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests7.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests7.cxx index f32c24d7c4..7a30f3a25b 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests7.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests7.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -41,4 +40,3 @@ void RegisterTests() REGISTER_TEST(otbVectorImageToIntensityImageFilterNew); REGISTER_TEST(otbVectorImageToIntensityImageFilter); } - diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests8.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests8.cxx index 8c36c2bf2a..3d16f1defa 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests8.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests8.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests9.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests9.cxx index 4c2ba71ef2..48041b4ce3 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests9.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests9.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/BasicFilters/otbBinaryImageDensityFunction.cxx b/Testing/Code/BasicFilters/otbBinaryImageDensityFunction.cxx index 2e4d376a62..a8dc85bb82 100644 --- a/Testing/Code/BasicFilters/otbBinaryImageDensityFunction.cxx +++ b/Testing/Code/BasicFilters/otbBinaryImageDensityFunction.cxx @@ -21,55 +21,52 @@ #include "otbImageFileReader.h" #include <iostream> -int otbBinaryImageDensityFunction(int argc, char* argv[] ) +int otbBinaryImageDensityFunction(int argc, char* argv[]) { - + const char * infname = argv[1]; const char * outfname = argv[2]; - const unsigned int Dimension = 2; - typedef float PixelType; - - typedef otb::Image<PixelType, Dimension> InputImageType; - typedef InputImageType::IndexType IndexType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::BinaryImageDensityFunction<InputImageType> FunctionType; + const unsigned int Dimension = 2; + typedef float PixelType; + + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef InputImageType::IndexType IndexType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::BinaryImageDensityFunction<InputImageType> FunctionType; /**Instantiation ofa Smart Pointer*/ - FunctionType::Pointer filter = FunctionType::New(); - ReaderType::Pointer reader = ReaderType::New(); - + FunctionType::Pointer filter = FunctionType::New(); + ReaderType::Pointer reader = ReaderType::New(); + std::ofstream outfile(outfname); /** Input Image*/ reader->SetFileName(infname); reader->Update(); - + /** Computing the density around a pixel */ filter->SetInputImage(reader->GetOutput()); filter->SetNeighborhoodRadius(2); - + /** Test on some indexes and some physical coordinates*/ - InputImageType::SizeType size = reader->GetOutput()->GetRequestedRegion().GetSize(); - FunctionType::PointType pDst; - IndexType index; + InputImageType::SizeType size = reader->GetOutput()->GetRequestedRegion().GetSize(); + FunctionType::PointType pDst; + IndexType index; index[0] = 0; index[1] = 0; - outfile << "Density computed for the point : " << index << " is "<< filter->EvaluateAtIndex(index) << std::endl; - - index[0] = static_cast<unsigned int >(size[0]/2.); - index[1] = static_cast<unsigned int >(size[1]/4.); - outfile << "Density computed for the point : " << index << " is "<< filter->EvaluateAtIndex(index) << std::endl; - - pDst[0] = static_cast<unsigned int >(size[0]/2.); - pDst[1] = static_cast<unsigned int >(size[1]/4.); - outfile << "Density computed for the point : " << pDst<< " is "<< filter->Evaluate(pDst) << std::endl; - - + outfile << "Density computed for the point : " << index << " is " << filter->EvaluateAtIndex(index) << std::endl; + + index[0] = static_cast<unsigned int>(size[0] / 2.); + index[1] = static_cast<unsigned int>(size[1] / 4.); + outfile << "Density computed for the point : " << index << " is " << filter->EvaluateAtIndex(index) << std::endl; + + pDst[0] = static_cast<unsigned int>(size[0] / 2.); + pDst[1] = static_cast<unsigned int>(size[1] / 4.); + outfile << "Density computed for the point : " << pDst << " is " << filter->Evaluate(pDst) << std::endl; outfile.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbBinaryImageDensityFunctionNew.cxx b/Testing/Code/BasicFilters/otbBinaryImageDensityFunctionNew.cxx index fc4c5ccc9a..b85d0c7fb2 100644 --- a/Testing/Code/BasicFilters/otbBinaryImageDensityFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbBinaryImageDensityFunctionNew.cxx @@ -25,18 +25,17 @@ #include "otbBinaryImageDensityFunction.h" #include "otbImage.h" -int otbBinaryImageDensityFunctionNew(int, char* [] ) +int otbBinaryImageDensityFunctionNew(int, char*[]) { - const unsigned int Dimension = 2; - typedef float PixelType; - typedef otb::Image<PixelType, Dimension> InputImageType; + const unsigned int Dimension = 2; + typedef float PixelType; + typedef otb::Image<PixelType, Dimension> InputImageType; - typedef otb::BinaryImageDensityFunction<InputImageType> FunctionType; + typedef otb::BinaryImageDensityFunction<InputImageType> FunctionType; /**Instantiation of a Smart Pointer*/ - FunctionType::Pointer filter = FunctionType::New(); + FunctionType::Pointer filter = FunctionType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.cxx b/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.cxx index 1d54cb40c4..c6b570f07a 100644 --- a/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.cxx +++ b/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.cxx @@ -28,53 +28,52 @@ int otbBinaryImageMinimalBoundingRegionCalculator(int argc, char* argv[]) int nbImages = atoi(argv[1]); char * outfile = argv[2]; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::BinaryImageMinimalBoundingRegionCalculator<ImageType> BoundingRegionCalculatorType; typedef BoundingRegionCalculatorType::RegionType RegionType; - typedef otb::ImageList<ImageType> ImageListType; - typedef ImageListType::Iterator IteratorType; + typedef otb::ImageList<ImageType> ImageListType; + typedef ImageListType::Iterator IteratorType; // reference image list ImageListType::Pointer images = ImageListType::New(); // Reading input images std::ofstream out; - out.open(outfile,std::ios::out); - out<<"Test results from otbBinaryImageBoundingRegionCalculator test."<<std::endl; - for (int i=1;i<=nbImages;++i) - { + out.open(outfile, std::ios::out); + out << "Test results from otbBinaryImageBoundingRegionCalculator test." << std::endl; + for (int i = 1; i <= nbImages; ++i) + { ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(argv[2+i]); + reader->SetFileName(argv[2 + i]); reader->Update(); images->PushBack(reader->GetOutput()); - } + } // Declaration BoundingRegionCalculatorType::Pointer brct; // Computing bounding region for each image - for (IteratorType it=images->Begin();it!=images->End();++it) - { + for (IteratorType it = images->Begin(); it != images->End(); ++it) + { brct = BoundingRegionCalculatorType::New(); brct->SetInput(it.Get()); brct->Update(); RegionType region = brct->GetRegion(); - out<<region.GetIndex()<<"\t"<<region.GetSize()<<std::endl; - } - out<<std::endl<<"Testing the pad option"<<std::endl<<std::endl; - for (IteratorType it=images->Begin();it!=images->End();++it) - { + out << region.GetIndex() << "\t" << region.GetSize() << std::endl; + } + out << std::endl << "Testing the pad option" << std::endl << std::endl; + for (IteratorType it = images->Begin(); it != images->End(); ++it) + { brct = BoundingRegionCalculatorType::New(); brct->SetPad(1); brct->SetInput(it.Get()); brct->Update(); RegionType region = brct->GetRegion(); - out<<region.GetIndex()<<"\t"<<region.GetSize()<<std::endl; - } + out << region.GetIndex() << "\t" << region.GetSize() << std::endl; + } out.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx b/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx index 424fde59d5..78728548e3 100644 --- a/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx +++ b/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx @@ -23,14 +23,13 @@ int otbBinaryImageMinimalBoundingRegionCalculatorNew(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; typedef otb::BinaryImageMinimalBoundingRegionCalculator<ImageType> BoundingRegionCalculatorType; //Instantiation BoundingRegionCalculatorType::Pointer brct = BoundingRegionCalculatorType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilter.cxx b/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilter.cxx index 99b9940808..c5f4a49f3b 100644 --- a/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilter.cxx @@ -22,41 +22,36 @@ #include "otbBinaryImageDensityFunction.h" #include "otbBinaryImageToDensityImageFilter.h" - -int otbBinaryImageToDensityImageFilter(int argc , char* argv[] ) +int otbBinaryImageToDensityImageFilter(int argc, char* argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; - const unsigned int radius = atoi(argv[3]); + const char * infname = argv[1]; + const char * outfname = argv[2]; + const unsigned int radius = atoi(argv[3]); - const unsigned int Dimension = 2; - typedef float PixelType; - typedef otb::Image<PixelType, Dimension> InputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<InputImageType> WriterType; + const unsigned int Dimension = 2; + typedef float PixelType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<InputImageType> WriterType; - typedef otb::BinaryImageDensityFunction<InputImageType> CountFunctionType; - typedef otb::BinaryImageToDensityImageFilter<InputImageType,InputImageType ,CountFunctionType > FilterType; + typedef otb::BinaryImageDensityFunction<InputImageType> CountFunctionType; + typedef otb::BinaryImageToDensityImageFilter<InputImageType, InputImageType, CountFunctionType> FilterType; - /** Instantiation of a Smart Pointer*/ - FilterType::Pointer filter = FilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - + FilterType::Pointer filter = FilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + /** */ reader->SetFileName(infname); filter->SetInput(reader->GetOutput()); filter->SetNeighborhoodRadius(radius); - /** */ writer->SetFileName(outfname); writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilterNew.cxx b/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilterNew.cxx index 0eab001cda..86d8b8a814 100644 --- a/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilterNew.cxx @@ -26,19 +26,17 @@ #include "otbBinaryImageToDensityImageFilter.h" #include "otbImage.h" -int otbBinaryImageToDensityImageFilterNew(int, char* [] ) +int otbBinaryImageToDensityImageFilterNew(int, char*[]) { - const unsigned int Dimension = 2; - typedef float PixelType; - typedef otb::Image<PixelType, Dimension> InputImageType; - typedef otb::BinaryImageDensityFunction<InputImageType> CountFunctionType; - typedef otb::BinaryImageToDensityImageFilter<InputImageType,InputImageType ,CountFunctionType > FilterType; - + const unsigned int Dimension = 2; + typedef float PixelType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef otb::BinaryImageDensityFunction<InputImageType> CountFunctionType; + typedef otb::BinaryImageToDensityImageFilter<InputImageType, InputImageType, CountFunctionType> FilterType; /**Instantiation of a Smart Pointer*/ - FilterType::Pointer filter = FilterType::New(); + FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilterNew.cxx b/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilterNew.cxx index b6d952d824..6f3dec000d 100644 --- a/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilterNew.cxx @@ -24,16 +24,14 @@ #include "otbVectorImage.h" #include "otbBoxAndWhiskerImageFilter.h" -int otbBoxAndWhiskerImageFilterNew ( int argc, char * argv[] ) +int otbBoxAndWhiskerImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage< PixelType, Dimension > ImageType; - typedef otb::BoxAndWhiskerImageFilter< ImageType > FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::BoxAndWhiskerImageFilter<ImageType> FilterType; + + FilterType::Pointer filter = FilterType::New(); - FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbChangeLabelImageFilter.cxx b/Testing/Code/BasicFilters/otbChangeLabelImageFilter.cxx index 459f8c0a1f..230eb09ac8 100644 --- a/Testing/Code/BasicFilters/otbChangeLabelImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbChangeLabelImageFilter.cxx @@ -28,48 +28,46 @@ int otbChangeLabelImageFilter(int argc, char * argv[]) { const unsigned int ImageDimension = 2; - const char * inputFilename(argv[1]); - const char * outFilename(argv[2]); - typedef unsigned short PixelType; - typedef otb::Image<PixelType, ImageDimension> InputImageType; - typedef otb::VectorImage<PixelType, ImageDimension> OutputImageType; + const char * inputFilename(argv[1]); + const char * outFilename(argv[2]); + typedef unsigned short PixelType; + typedef otb::Image<PixelType, ImageDimension> InputImageType; + typedef otb::VectorImage<PixelType, ImageDimension> OutputImageType; typedef InputImageType::PixelType InputPixelType; typedef OutputImageType::PixelType OutputPixelType; typedef itk::ImageRegionIteratorWithIndex<InputImageType> InputIteratorType; typedef itk::ImageRegionIteratorWithIndex<OutputImageType> OutputIteratorType; typedef itk::RandomImageSource<InputImageType> SourceType; typedef otb::ChangeLabelImageFilter<InputImageType, OutputImageType> FilterType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; - SourceType::Pointer source = SourceType::New(); - FilterType::Pointer filter = FilterType::New(); - InputImageType::Pointer vectImage = InputImageType::New(); + SourceType::Pointer source = SourceType::New(); + FilterType::Pointer filter = FilterType::New(); + InputImageType::Pointer vectImage = InputImageType::New(); WriterType::Pointer writer = WriterType::New(); ReaderType::Pointer reader = ReaderType::New(); - - reader->SetFileName( inputFilename ); - writer->SetFileName( outFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outFilename); InputPixelType lower = static_cast<PixelType>(atoi(argv[3])); InputPixelType upper = static_cast<PixelType>(atoi(argv[4])); filter->SetNumberOfComponentsPerPixel(3); OutputPixelType background; - background.SetSize( filter->GetNumberOfComponentsPerPixel() ); + background.SetSize(filter->GetNumberOfComponentsPerPixel()); background[0] = itk::NumericTraits<PixelType>::max(); background[1] = itk::NumericTraits<PixelType>::max(); background[2] = 0; - - filter->SetChange( 0,0 ); + filter->SetChange(0, 0); for (InputPixelType i = lower; i <= upper; i++) - { - filter->SetChange( i, background ); - } + { + filter->SetChange(i, background); + } - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); writer->SetInput(filter->GetOutput()); writer->Update(); diff --git a/Testing/Code/BasicFilters/otbChangeLabelImageFilterNew.cxx b/Testing/Code/BasicFilters/otbChangeLabelImageFilterNew.cxx index 6df0724ffb..9d10497518 100644 --- a/Testing/Code/BasicFilters/otbChangeLabelImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbChangeLabelImageFilterNew.cxx @@ -26,14 +26,13 @@ int otbChangeLabelImageFilterNew(int argc, char * argv[]) { const unsigned int ImageDimension = 2; - typedef otb::Image<unsigned int, ImageDimension> InputImageType; + typedef otb::Image<unsigned int, ImageDimension> InputImageType; typedef otb::VectorImage<unsigned int, ImageDimension> OutputImageType; - typedef otb::ChangeLabelImageFilter<InputImageType, OutputImageType> FilterType; + typedef otb::ChangeLabelImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbClosePathFunctor.cxx b/Testing/Code/BasicFilters/otbClosePathFunctor.cxx index 89b28c2ec0..9d2e88288c 100644 --- a/Testing/Code/BasicFilters/otbClosePathFunctor.cxx +++ b/Testing/Code/BasicFilters/otbClosePathFunctor.cxx @@ -32,28 +32,28 @@ #include "otbClosePathFunctor.h" #include "otbUnaryFunctorObjectListFilter.h" -int otbClosePathFunctor( int argc, char * argv[] ) +int otbClosePathFunctor(int argc, char * argv[]) { - if (argc !=3 ) - { + if (argc != 3) + { std::cout << "Usage: " << argv[0]; std::cout << " inputImage outputFile" << std::endl; return 1; - } + } typedef unsigned char InputPixelType; - typedef unsigned short LabelPixelType;//FIXME doesn't seem to work with long int (64 bits problem ?) + typedef unsigned short LabelPixelType; //FIXME doesn't seem to work with long int (64 bits problem ?) - typedef otb::Image<InputPixelType,2> InputImageType; - typedef otb::Image<LabelPixelType,2> LabelImageType; + typedef otb::Image<InputPixelType, 2> InputImageType; + typedef otb::Image<LabelPixelType, 2> LabelImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); - typedef itk::ConnectedComponentImageFilter<InputImageType,LabelImageType> ConnectedComponentsFilterType; - ConnectedComponentsFilterType::Pointer connectedComponentsFilter = ConnectedComponentsFilterType::New(); + typedef itk::ConnectedComponentImageFilter<InputImageType, LabelImageType> ConnectedComponentsFilterType; + ConnectedComponentsFilterType::Pointer connectedComponentsFilter = ConnectedComponentsFilterType::New(); // connectedComponentsFilter->SetInput(reader->GetOutput()); connectedComponentsFilter->SetInput(reader->GetOutput()); @@ -61,14 +61,14 @@ int otbClosePathFunctor( int argc, char * argv[] ) std::cout << "# regions: " << connectedComponentsFilter->GetObjectCount() << std::endl; - typedef otb::Polygon<double> PolygonType; - typedef otb::ObjectList<PolygonType> PolygonListType; - typedef otb::ImageToEdgePathFilter<LabelImageType,PolygonType> PolygonFilterType; + typedef otb::Polygon<double> PolygonType; + typedef otb::ObjectList<PolygonType> PolygonListType; + typedef otb::ImageToEdgePathFilter<LabelImageType, PolygonType> PolygonFilterType; PolygonListType::Pointer polygonList = PolygonListType::New(); - for (LabelPixelType label = 1; label<=connectedComponentsFilter->GetObjectCount();++label) - { + for (LabelPixelType label = 1; label <= connectedComponentsFilter->GetObjectCount(); ++label) + { std::cerr << "."; PolygonFilterType::Pointer polygonFilter = PolygonFilterType::New(); polygonFilter->SetInput(connectedComponentsFilter->GetOutput()); @@ -76,39 +76,38 @@ int otbClosePathFunctor( int argc, char * argv[] ) polygonFilter->Update(); polygonList->PushBack(polygonFilter->GetOutput()); - } + } - typedef otb::ClosePathFunctor<PolygonType, PolygonType> LengthFunctorType; - typedef otb::UnaryFunctorObjectListFilter<PolygonListType,PolygonListType,LengthFunctorType> ClosePathFilterType; + typedef otb::ClosePathFunctor<PolygonType, PolygonType> LengthFunctorType; + typedef otb::UnaryFunctorObjectListFilter<PolygonListType, PolygonListType, LengthFunctorType> ClosePathFilterType; ClosePathFilterType::Pointer closePathFilter = ClosePathFilterType::New(); closePathFilter->SetInput(polygonList); closePathFilter->Update(); - const char * outfile = argv[2]; + const char * outfile = argv[2]; std::ofstream file; file.open(outfile); - typedef PolygonType::VertexListType VertexListType; + typedef PolygonType::VertexListType VertexListType; typedef VertexListType::ConstIterator IteratorType; typedef PolygonListType::ConstIterator PolygonListIteratorType; for (PolygonListIteratorType pIt = closePathFilter->GetOutput()->Begin(); - pIt!=closePathFilter->GetOutput()->End(); + pIt != closePathFilter->GetOutput()->End(); ++pIt) - { - file<< "--- New Polygon ---" << std::endl; - PolygonType::Pointer polygon=pIt.Get(); - IteratorType it; - for (it=polygon->GetVertexList()->Begin();it!=polygon->GetVertexList()->End();++it) { - file<<it.Value()<<std::endl; - + file << "--- New Polygon ---" << std::endl; + PolygonType::Pointer polygon = pIt.Get(); + IteratorType it; + for (it = polygon->GetVertexList()->Begin(); it != polygon->GetVertexList()->End(); ++it) + { + file << it.Value() << std::endl; + + } } - } file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilter.cxx b/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilter.cxx index e08c64eb09..d780699287 100644 --- a/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilter.cxx +++ b/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilter.cxx @@ -34,15 +34,15 @@ int otbClosingOpeningMorphologicalFilter(int argc, char * argv[]) typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::ClosingOpeningMorphologicalFilter<InputImageType,OutputImageType, - StructuringElementType> ClosingOpeningFilterType; + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::ClosingOpeningMorphologicalFilter<InputImageType, OutputImageType, + StructuringElementType> ClosingOpeningFilterType; // Reading input image ReaderType::Pointer reader = ReaderType::New(); @@ -64,6 +64,5 @@ int otbClosingOpeningMorphologicalFilter(int argc, char * argv[]) writer->SetInput(openingClosing->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilterNew.cxx b/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilterNew.cxx index fc09534fa6..b869fe75ff 100644 --- a/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilterNew.cxx @@ -24,17 +24,16 @@ int otbClosingOpeningMorphologicalFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::ClosingOpeningMorphologicalFilter<InputImageType,OutputImageType, - StructuringElementType> ClosingOpeningFilterType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::ClosingOpeningMorphologicalFilter<InputImageType, OutputImageType, + StructuringElementType> ClosingOpeningFilterType; // instantiating the opening closing filter ClosingOpeningFilterType::Pointer openingClosing = ClosingOpeningFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter.cxx b/Testing/Code/BasicFilters/otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter.cxx index e45178ef33..8e8fd9b5a2 100644 --- a/Testing/Code/BasicFilters/otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter.cxx +++ b/Testing/Code/BasicFilters/otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter.cxx @@ -8,7 +8,6 @@ #include <math.h> - #include <iostream> #include "otbImage.h" #include "otbImageFileReader.h" @@ -19,44 +18,45 @@ #include "itkConstantBoundaryCondition.h" #include "itkTimeProbe.h" -int otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter( int argc, char *argv[]) +int otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter(int argc, char *argv[]) { - if (argc!=12) - { - std::cerr<<"Usage: "<<argv[0]<<" infname outfname1 outfname2 xradius yradius a b theta u0 v0 phi"<<std::endl; + if (argc != 12) + { + std::cerr << "Usage: " << argv[0] << " infname outfname1 outfname2 xradius yradius a b theta u0 v0 phi" << + std::endl; return EXIT_FAILURE; - } + } - const char * infname = argv[1]; - const char * outfname1 = argv[2]; - const char * outfname2 = argv[3]; + const char * infname = argv[1]; + const char * outfname1 = argv[2]; + const char * outfname2 = argv[3]; const unsigned int xradius = atoi(argv[4]); const unsigned int yradius = atoi(argv[5]); - const double a = atof(argv[6]); - const double b = atof(argv[7]); - const double theta = atof(argv[8]); - const double u0 = atof(argv[9]); - const double v0 = atof(argv[10]); - const double phi = atof(argv[11]); - - typedef double PrecisionType; + const double a = atof(argv[6]); + const double b = atof(argv[7]); + const double theta = atof(argv[8]); + const double u0 = atof(argv[9]); + const double v0 = atof(argv[10]); + const double phi = atof(argv[11]); + + typedef double PrecisionType; typedef otb::GaborFilterGenerator<PrecisionType> GaborGeneratorType; - typedef GaborGeneratorType::RadiusType RadiusType; - typedef GaborGeneratorType::ArrayType ArrayType; + typedef GaborGeneratorType::RadiusType RadiusType; + typedef GaborGeneratorType::ArrayType ArrayType; - typedef otb::Image<PrecisionType,2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; - typedef otb::OverlapSaveConvolutionImageFilter<ImageType,ImageType> OSConvolutionFilterType; + typedef otb::Image<PrecisionType, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::OverlapSaveConvolutionImageFilter<ImageType, ImageType> OSConvolutionFilterType; // Setting the same boundary conditions than the one used in the overlap save convolution filter - typedef itk::ConstantBoundaryCondition<ImageType> BoundaryConditionType; - typedef otb::ConvolutionImageFilter<ImageType,ImageType,BoundaryConditionType> ConvolutionFilterType; + typedef itk::ConstantBoundaryCondition<ImageType> BoundaryConditionType; + typedef otb::ConvolutionImageFilter<ImageType, ImageType, BoundaryConditionType> ConvolutionFilterType; // Gabor filter generation GaborGeneratorType::Pointer gabor = GaborGeneratorType::New(); - RadiusType radius; - radius[0]=xradius; - radius[1]=yradius; + RadiusType radius; + radius[0] = xradius; + radius[1] = yradius; gabor->SetRadius(radius); gabor->SetA(a); gabor->SetB(b); @@ -69,7 +69,7 @@ int otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter( int argc, char ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); - itk::TimeProbe probe1,probe2; + itk::TimeProbe probe1, probe2; ConvolutionFilterType::Pointer convolution = ConvolutionFilterType::New(); convolution->SetRadius(radius); @@ -84,7 +84,7 @@ int otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter( int argc, char writer1->Update(); probe1.Stop(); - std::cout<<"Classical convolution algorithm took "<<probe1.GetMeanTime()<<" seconds."<<std::endl; + std::cout << "Classical convolution algorithm took " << probe1.GetMeanTime() << " seconds." << std::endl; OSConvolutionFilterType::Pointer osconvolution = OSConvolutionFilterType::New(); osconvolution->SetRadius(radius); @@ -99,8 +99,7 @@ int otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter( int argc, char writer2->Update(); probe2.Stop(); - std::cout<<"Overlap-save convolution algorithm took "<<probe2.GetMeanTime()<<" seconds."<<std::endl; - + std::cout << "Overlap-save convolution algorithm took " << probe2.GetMeanTime() << " seconds." << std::endl; return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorNew.cxx b/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorNew.cxx index a107966c4c..e8e31658d2 100644 --- a/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorNew.cxx +++ b/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorNew.cxx @@ -17,7 +17,6 @@ =========================================================================*/ #include "itkExceptionObject.h" - #include "otbImage.h" #include "otbContinuousMinimumMaximumImageCalculator.h" @@ -27,11 +26,10 @@ int otbContinuousMinimumMaximumImageCalculatorNew(int argc, char * argv[]) typedef otb::Image<unsigned int, ImageDimension> InputImageType; - typedef otb::ContinuousMinimumMaximumImageCalculator<InputImageType> FilterType; + typedef otb::ContinuousMinimumMaximumImageCalculator<InputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorTest.cxx b/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorTest.cxx index 122b7f0a92..a2d396ef5d 100644 --- a/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorTest.cxx +++ b/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorTest.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif @@ -25,26 +24,26 @@ #include "itkSize.h" int -otbContinuousMinimumMaximumImageCalculatorTest(int ,char *[] ) +otbContinuousMinimumMaximumImageCalculatorTest(int, char *[]) { - typedef short int PixelType; - typedef itk::Size<2> SizeType; - typedef otb::Image<PixelType, 2> ImageType; + typedef short int PixelType; + typedef itk::Size<2> SizeType; + typedef otb::Image<PixelType, 2> ImageType; - typedef otb::ContinuousMinimumMaximumImageCalculator<ImageType> MinMaxCalculatorType; + typedef otb::ContinuousMinimumMaximumImageCalculator<ImageType> MinMaxCalculatorType; /* Define the image size and physical coordinates */ SizeType size = {{20, 20}}; - double origin [2] = { 0.0, 0.0}; - double spacing[2] = { 1, 1}; + double origin[2] = { 0.0, 0.0}; + double spacing[2] = { 1, 1}; int flag = 0; /* Did this test program work? */ std::cout << "Testing Minimum and Maximum Image Calculator:\n"; // Allocate a simple test image - ImageType::Pointer image = ImageType::New(); + ImageType::Pointer image = ImageType::New(); ImageType::RegionType region; region.SetSize(size); image->SetLargestPossibleRegion(region); @@ -59,19 +58,17 @@ otbContinuousMinimumMaximumImageCalculatorTest(int ,char *[] ) PixelType minimum = -52; PixelType maximum = 103; - // Initialize the image contents with the minimum value itk::Index<2> index; - for (int row = 0; row <20; row++) - { + for (int row = 0; row < 20; row++) + { index[1] = row; for (int col = 0; col < 20; col++) - { + { index[0] = col; image->SetPixel(index, minimum); + } } - } - // Set voxel (10,10) to maximum value index[0] = 10; @@ -82,10 +79,9 @@ otbContinuousMinimumMaximumImageCalculatorTest(int ,char *[] ) index[1] = 11; image->SetPixel(index, 41); - // Create and initialize the calculator MinMaxCalculatorType::Pointer calculator = MinMaxCalculatorType::New(); - calculator->SetImage( image ); + calculator->SetImage(image); calculator->Compute(); // Return minimum of intensity @@ -94,11 +90,11 @@ otbContinuousMinimumMaximumImageCalculatorTest(int ,char *[] ) std::cout << "Its index position is : " << calculator->GetContinuousIndexOfMinimum() << std::endl; if (minimumResult != minimum) - { + { std::cout << "Minimum Value is wrong : " << minimumResult; std::cout << " != " << minimum << std::endl; flag = 1; - } + } // Return maximum of intensity PixelType maximumResult = calculator->GetMaximum(); @@ -106,25 +102,23 @@ otbContinuousMinimumMaximumImageCalculatorTest(int ,char *[] ) std::cout << "Its index position is : " << calculator->GetContinuousIndexOfMaximum() << std::endl; if (maximumResult != maximum) - { + { std::cout << "Maximum Value is wrong : " << maximumResult; std::cout << " != " << maximum << std::endl; flag = 2; - } - + } // Return results of test if (flag != 0) - { + { std::cout << "*** Some tests failed" << std::endl; return flag; - } + } else - { + { std::cout << "All tests successfully passed" << std::endl; return EXIT_SUCCESS; - } + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbConvolutionImageFilter.cxx b/Testing/Code/BasicFilters/otbConvolutionImageFilter.cxx index 2e8feeaf17..46548d6486 100644 --- a/Testing/Code/BasicFilters/otbConvolutionImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbConvolutionImageFilter.cxx @@ -25,23 +25,22 @@ #include "otbConvolutionImageFilter.h" #include "itkConstantBoundaryCondition.h" - -int otbConvolutionImageFilter( int argc, char * argv[] ) +int otbConvolutionImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > PanchroImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< PanchroImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::Image<InputPixelType, Dimension> PanchroImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<PanchroImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; // Overriding boundary condition to compare with the overlap save convolution results. - typedef itk::ConstantBoundaryCondition<PanchroImageType> BoundaryConditionType; - typedef otb::ConvolutionImageFilter< PanchroImageType,OutputImageType, BoundaryConditionType > ConvFilterType; + typedef itk::ConstantBoundaryCondition<PanchroImageType> BoundaryConditionType; + typedef otb::ConvolutionImageFilter<PanchroImageType, OutputImageType, BoundaryConditionType> ConvFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -51,19 +50,19 @@ int otbConvolutionImageFilter( int argc, char * argv[] ) writer->SetFileName(outputFileName); ConvFilterType::InputSizeType radius; - radius[0]=3; - radius[1]=3; + radius[0] = 3; + radius[1] = 3; //itk::Array< double > filterCoeffs; ConvFilterType::ArrayType filterCoeffs; - filterCoeffs.SetSize((2*radius[0]+1)*(2*radius[1]+1)); + filterCoeffs.SetSize((2 * radius[0] + 1) * (2 * radius[1] + 1)); filterCoeffs.Fill(1); convFilter->SetRadius(radius); convFilter->SetFilter(filterCoeffs); convFilter->NormalizeFilterOn(); - convFilter->SetInput( reader->GetOutput() ); - writer->SetInput( convFilter->GetOutput() ); + convFilter->SetInput(reader->GetOutput()); + writer->SetInput(convFilter->GetOutput()); writer->Update(); diff --git a/Testing/Code/BasicFilters/otbConvolutionImageFilterNew.cxx b/Testing/Code/BasicFilters/otbConvolutionImageFilterNew.cxx index 0a4b7eab84..d8115ed0b7 100644 --- a/Testing/Code/BasicFilters/otbConvolutionImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbConvolutionImageFilterNew.cxx @@ -22,19 +22,17 @@ #include "otbImage.h" #include "otbConvolutionImageFilter.h" - -int otbConvolutionImageFilterNew( int argc, char * argv[] ) +int otbConvolutionImageFilterNew(int argc, char * argv[]) { - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ConvolutionImageFilter< InputImageType,OutputImageType > FilterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ConvolutionImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer conv = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbEdgeDensityImageFilter.cxx b/Testing/Code/BasicFilters/otbEdgeDensityImageFilter.cxx index 5d460657ba..5864457bb6 100644 --- a/Testing/Code/BasicFilters/otbEdgeDensityImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbEdgeDensityImageFilter.cxx @@ -23,46 +23,45 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - -int otbEdgeDensityImageFilter(int argc, char* argv[] ) +int otbEdgeDensityImageFilter(int argc, char* argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; - const unsigned int radius = atoi(argv[3]); + const char * infname = argv[1]; + const char * outfname = argv[2]; + const unsigned int radius = atoi(argv[3]); /** Variables for the canny detector*/ - const double upperThreshold = atof(argv[4]); - const double lowerThreshold = atof(argv[5]); - const double variance = atof(argv[6]); - const double maximumError = atof(argv[7]); + const double upperThreshold = atof(argv[4]); + const double lowerThreshold = atof(argv[5]); + const double variance = atof(argv[6]); + const double maximumError = atof(argv[7]); /*--*/ - - const unsigned int Dimension = 2; - typedef float PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef ImageType::IndexType IndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + const unsigned int Dimension = 2; + typedef float PixelType; + + typedef otb::Image<PixelType, Dimension> ImageType; + typedef ImageType::IndexType IndexType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::BinaryImageDensityFunction<ImageType> CountFunctionType; - typedef itk::CannyEdgeDetectionImageFilter<ImageType , ImageType> CannyDetectorType; + typedef otb::BinaryImageDensityFunction<ImageType> CountFunctionType; + typedef itk::CannyEdgeDetectionImageFilter<ImageType, ImageType> CannyDetectorType; - typedef otb::EdgeDensityImageFilter<ImageType, ImageType, CannyDetectorType ,CountFunctionType> EdgeDensityFilterType; + typedef otb::EdgeDensityImageFilter<ImageType, ImageType, CannyDetectorType, CountFunctionType> EdgeDensityFilterType; /**Instantiation of an object*/ - EdgeDensityFilterType::Pointer filter = EdgeDensityFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - CannyDetectorType::Pointer CannyFilter = CannyDetectorType::New(); + EdgeDensityFilterType::Pointer filter = EdgeDensityFilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + CannyDetectorType::Pointer CannyFilter = CannyDetectorType::New(); /** Set The input*/ reader->SetFileName(infname); filter->SetInput(reader->GetOutput()); - + /** Update the Canny Filter Information*/ CannyFilter->SetUpperThreshold(static_cast<ImageType::PixelType>(upperThreshold)); /** 30*/ - CannyFilter->SetLowerThreshold(static_cast<ImageType::PixelType>(lowerThreshold));/** 10*/ + CannyFilter->SetLowerThreshold(static_cast<ImageType::PixelType>(lowerThreshold)); /** 10*/ CannyFilter->SetVariance(variance); //1. CannyFilter->SetMaximumError(maximumError); ///0.01f @@ -70,11 +69,10 @@ int otbEdgeDensityImageFilter(int argc, char* argv[] ) filter->SetNeighborhoodRadius(radius); /** Write the output*/ - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outfname); writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbEdgeDensityImageFilterNew.cxx b/Testing/Code/BasicFilters/otbEdgeDensityImageFilterNew.cxx index ae2ca5472a..481cd37aef 100644 --- a/Testing/Code/BasicFilters/otbEdgeDensityImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbEdgeDensityImageFilterNew.cxx @@ -20,24 +20,22 @@ #include "otbBinaryImageDensityFunction.h" #include "itkCannyEdgeDetectionImageFilter.h" - -int otbEdgeDensityImageFilterNew(int, char* [] ) +int otbEdgeDensityImageFilterNew(int, char*[]) { - const unsigned int Dimension = 2; - typedef float PixelType; + const unsigned int Dimension = 2; + typedef float PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef ImageType::IndexType IndexType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef ImageType::IndexType IndexType; - typedef otb::BinaryImageDensityFunction<ImageType> CountFunctionType; - typedef itk::CannyEdgeDetectionImageFilter<ImageType , ImageType> CannyDetectorType; + typedef otb::BinaryImageDensityFunction<ImageType> CountFunctionType; + typedef itk::CannyEdgeDetectionImageFilter<ImageType, ImageType> CannyDetectorType; - typedef otb::EdgeDensityImageFilter<ImageType , ImageType , CannyDetectorType ,CountFunctionType> EdgeDensityFilterType; + typedef otb::EdgeDensityImageFilter<ImageType, ImageType, CannyDetectorType, CountFunctionType> EdgeDensityFilterType; /**Instantiation of an object*/ - EdgeDensityFilterType::Pointer filter = EdgeDensityFilterType::New(); + EdgeDensityFilterType::Pointer filter = EdgeDensityFilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbEdgeDetectorImageFilter.cxx b/Testing/Code/BasicFilters/otbEdgeDetectorImageFilter.cxx index bdbf12a2ff..dec5576600 100644 --- a/Testing/Code/BasicFilters/otbEdgeDetectorImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbEdgeDetectorImageFilter.cxx @@ -21,16 +21,15 @@ #include "otbImageFileWriter.h" #include "itkSobelEdgeDetectionImageFilter.h" - -int otbEdgeDetectorImageFilter(int argc, char* argv[] ) +int otbEdgeDetectorImageFilter(int argc, char* argv[]) { - typedef double PixelType; - typedef otb::Image< PixelType, 2 > ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::SobelEdgeDetectionImageFilter<ImageType , ImageType> SobelDetectionType; - typedef otb::EdgeDetectorImageFilter<ImageType, ImageType, SobelDetectionType> DetectorType; + typedef itk::SobelEdgeDetectionImageFilter<ImageType, ImageType> SobelDetectionType; + typedef otb::EdgeDetectorImageFilter<ImageType, ImageType, SobelDetectionType> DetectorType; /**Instantiation of an object*/ ReaderType::Pointer reader = ReaderType::New(); @@ -40,7 +39,7 @@ int otbEdgeDetectorImageFilter(int argc, char* argv[] ) reader->SetFileName(argv[1]); detector->SetInput(reader->GetOutput()); - + detector->SetLowerThreshold(static_cast<PixelType>(atof(argv[3]))); detector->SetUpperThreshold(static_cast<PixelType>(atof(argv[4]))); @@ -50,4 +49,3 @@ int otbEdgeDetectorImageFilter(int argc, char* argv[] ) return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbEdgeDetectorImageFilterNew.cxx b/Testing/Code/BasicFilters/otbEdgeDetectorImageFilterNew.cxx index 74b5b9e3d9..70c54e46d0 100644 --- a/Testing/Code/BasicFilters/otbEdgeDetectorImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbEdgeDetectorImageFilterNew.cxx @@ -19,12 +19,11 @@ #include "otbEdgeDetectorImageFilter.h" #include "itkSobelEdgeDetectionImageFilter.h" - -int otbEdgeDetectorImageFilterNew(int, char* [] ) +int otbEdgeDetectorImageFilterNew(int, char*[]) { - typedef double PixelType; + typedef double PixelType; - typedef otb::Image< PixelType, 2 > ImageType; + typedef otb::Image<PixelType, 2> ImageType; typedef itk::SobelEdgeDetectionImageFilter<ImageType, ImageType> SobelType; typedef otb::EdgeDetectorImageFilter<ImageType, ImageType, SobelType> FilterType; @@ -33,4 +32,3 @@ int otbEdgeDetectorImageFilterNew(int, char* [] ) return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilter.cxx b/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilter.cxx index 1d60ee4cc7..eb5b7e5275 100644 --- a/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilter.cxx @@ -21,26 +21,26 @@ #include "otbVectorImage.h" -int otbEstimateInnerProductPCAImageFilter( int argc, char* argv[] ) +int otbEstimateInnerProductPCAImageFilter(int argc, char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; - const char * inputFileName = argv[1]; - const char * outputFilename = argv[2]; + const char * inputFileName = argv[1]; + const char * outputFilename = argv[2]; const unsigned int numberOfPrincipalComponentsRequired(atoi(argv[3])); - const bool centerdata = atoi(argv[4]); + const bool centerdata = atoi(argv[4]); - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::ImageFileWriter< ImageType > WriterType; - typedef otb::EstimateInnerProductPCAImageFilter<ImageType,ImageType> PCAFilterType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::EstimateInnerProductPCAImageFilter<ImageType, ImageType> PCAFilterType; - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFilename); - PCAFilterType::Pointer pcafilter = PCAFilterType::New(); + PCAFilterType::Pointer pcafilter = PCAFilterType::New(); // Compute Inner Product raw pcafilter->SetNumberOfPrincipalComponentsRequired(numberOfPrincipalComponentsRequired); diff --git a/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilterNew.cxx b/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilterNew.cxx index bee5635a7c..a93a609774 100644 --- a/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilterNew.cxx @@ -18,14 +18,14 @@ #include "otbEstimateInnerProductPCAImageFilter.h" #include "otbVectorImage.h" -int otbEstimateInnerProductPCAImageFilterNew( int argc, char* argv[] ) +int otbEstimateInnerProductPCAImageFilterNew(int argc, char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; // Typedef - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::EstimateInnerProductPCAImageFilter<ImageType,ImageType> FilterType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::EstimateInnerProductPCAImageFilter<ImageType, ImageType> FilterType; // Instantiation object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbEuclideanDistanceWithMissingValue.cxx b/Testing/Code/BasicFilters/otbEuclideanDistanceWithMissingValue.cxx index 1bfdc978b6..a70e838141 100644 --- a/Testing/Code/BasicFilters/otbEuclideanDistanceWithMissingValue.cxx +++ b/Testing/Code/BasicFilters/otbEuclideanDistanceWithMissingValue.cxx @@ -18,28 +18,24 @@ =========================================================================*/ - #include <iostream> #include <cstdlib> #include "itkVariableLengthVector.h" #include "otbEuclideanDistanceWithMissingValue.h" -int otbEuclideanDistanceWithMissingValue( int argc, char * argv[] ) +int otbEuclideanDistanceWithMissingValue(int argc, char * argv[]) { - typedef itk::VariableLengthVector< double > VectorType; - typedef otb::Statistics::EuclideanDistanceWithMissingValue< VectorType > DistanceType; + typedef itk::VariableLengthVector<double> VectorType; + typedef otb::Statistics::EuclideanDistanceWithMissingValue<VectorType> DistanceType; DistanceType::Pointer dist = DistanceType::New(); - if ( dist->IsMissingValue( 0.0 ) ) - return EXIT_FAILURE; + if (dist->IsMissingValue(0.0)) return EXIT_FAILURE; - if ( dist->IsMissingValue( 1.0 ) ) - return EXIT_FAILURE; + if (dist->IsMissingValue(1.0)) return EXIT_FAILURE; - if ( dist->IsMissingValue( -1.0 ) ) - return EXIT_FAILURE; + if (dist->IsMissingValue(-1.0)) return EXIT_FAILURE; /* std::cerr << "Is O Nan ?? -> " << dist->IsMissingValue( 0.0 ) << "\n"; @@ -50,11 +46,8 @@ int otbEuclideanDistanceWithMissingValue( int argc, char * argv[] ) double x = 0.0; dist->SetToMissingValue(x); - if ( !dist->IsMissingValue( x ) ) - return EXIT_FAILURE; + if (!dist->IsMissingValue(x)) return EXIT_FAILURE; // std::cerr << "Is x (=" << x << ") Nan ?? -> " << dist->IsMissingValue( x ) << "\n"; return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbEuclideanDistanceWithMissingValueNew.cxx b/Testing/Code/BasicFilters/otbEuclideanDistanceWithMissingValueNew.cxx index 7c819a8c9f..5a85a5e1a0 100644 --- a/Testing/Code/BasicFilters/otbEuclideanDistanceWithMissingValueNew.cxx +++ b/Testing/Code/BasicFilters/otbEuclideanDistanceWithMissingValueNew.cxx @@ -18,21 +18,18 @@ =========================================================================*/ - #include <iostream> #include <cstdlib> #include "itkVariableLengthVector.h" #include "otbEuclideanDistanceWithMissingValue.h" -int otbEuclideanDistanceWithMissingValueNew( int argc, char * argv[] ) +int otbEuclideanDistanceWithMissingValueNew(int argc, char * argv[]) { - typedef itk::VariableLengthVector< double > VectorType; - typedef otb::Statistics::EuclideanDistanceWithMissingValue< VectorType > DistanceType; + typedef itk::VariableLengthVector<double> VectorType; + typedef otb::Statistics::EuclideanDistanceWithMissingValue<VectorType> DistanceType; DistanceType::Pointer dist = DistanceType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbExtractROIResample.cxx b/Testing/Code/BasicFilters/otbExtractROIResample.cxx index c52ec9749c..6782794cd4 100644 --- a/Testing/Code/BasicFilters/otbExtractROIResample.cxx +++ b/Testing/Code/BasicFilters/otbExtractROIResample.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "otbImage.h" #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" @@ -24,7 +23,6 @@ #include "itkIdentityTransform.h" #include "otbStreamingResampleImageFilter.h" - // Pipeline reader -> Resampler (with Identity transform) -> ExtractROI // -> Writer // the resample is optionaly removed with the command line parameter. @@ -32,25 +30,25 @@ int otbExtractROIResample(int argc, char* argv[]) { - if ( argc < 4 ) - { - std::cout << argv[0] <<" <input filename> <output filename> <use resample>" << std::endl; + if (argc < 4) + { + std::cout << argv[0] << " <input filename> <output filename> <use resample>" << std::endl; return EXIT_FAILURE; - } + } bool useResample = true; if (atoi(argv[3]) == 0) - { + { useResample = false; - } + } unsigned int startX = 10; - unsigned int startY= 10; + unsigned int startY = 10; unsigned int sizeX = 100; unsigned int sizeY = 100; - typedef double PixelType; - typedef otb::Image<PixelType,2> ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; @@ -59,8 +57,7 @@ int otbExtractROIResample(int argc, char* argv[]) reader->SetFileName(argv[1]); reader->UpdateOutputInformation(); - - typedef itk::IdentityTransform< double, 2 > IdentityTransformType; + typedef itk::IdentityTransform<double, 2> IdentityTransformType; IdentityTransformType::Pointer transform = IdentityTransformType::New(); typedef otb::StreamingResampleImageFilter<ImageType, ImageType, double> ResampleType; @@ -78,16 +75,16 @@ int otbExtractROIResample(int argc, char* argv[]) filterResampleRoi->SetSizeY(sizeY); if (useResample) - { + { filterResampleRoi->SetInput(filterResample->GetOutput()); - } + } else - { + { filterResampleRoi->SetInput(reader->GetOutput()); - } + } typedef otb::StreamingImageFileWriter<ImageType> WriterType; - WriterType::Pointer streamingWriter = WriterType:: New(); + WriterType::Pointer streamingWriter = WriterType::New(); streamingWriter->SetFileName(argv[2]); streamingWriter->SetInput(filterResampleRoi->GetOutput()); diff --git a/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValue.cxx b/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValue.cxx index c2d7dccf01..1aed28cd8a 100644 --- a/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValue.cxx +++ b/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValue.cxx @@ -18,45 +18,40 @@ =========================================================================*/ - #include <iostream> #include <cstdlib> #include <iomanip> #include "itkVariableLengthVector.h" #include "otbFlexibleDistanceWithMissingValue.h" -int otbFlexibleDistanceWithMissingValue( int argc, char * argv[] ) +int otbFlexibleDistanceWithMissingValue(int argc, char * argv[]) { - typedef itk::VariableLengthVector< double > VectorType; - typedef otb::Statistics::FlexibleDistanceWithMissingValue< VectorType > DistanceType; + typedef itk::VariableLengthVector<double> VectorType; + typedef otb::Statistics::FlexibleDistanceWithMissingValue<VectorType> DistanceType; const double epsilon(atof(argv[1])); - float a = 2.0; - float b = 0.5; + float a = 2.0; + float b = 0.5; unsigned int dim = 3; - DistanceType::SetAlphaBeta(a,b); + DistanceType::SetAlphaBeta(a, b); - VectorType x( dim ); - x.Fill( 1. ); + VectorType x(dim); + x.Fill(1.); - VectorType y( dim ); - y.Fill( 2. ); + VectorType y(dim); + y.Fill(2.); DistanceType::Pointer dist = DistanceType::New(); - double distanceValue = dist->Evaluate( x, y ); - std::cout << std::setprecision(20)<< std::endl; - std::cout << "dim,a,b : " << dim<<","<<a<<","<<b<< std::endl; - std::cout << "dim*vcl_pow(3,b) : " << dim*vcl_pow(3,b) << std::endl; + double distanceValue = dist->Evaluate(x, y); + std::cout << std::setprecision(20) << std::endl; + std::cout << "dim,a,b : " << dim << "," << a << "," << b << std::endl; + std::cout << "dim*vcl_pow(3,b) : " << dim*vcl_pow(3, b) << std::endl; std::cout << "Distance : " << distanceValue << std::endl; std::cout << "Epsilon : " << epsilon << std::endl; - std::cout << "-> Tests diff : " << vcl_abs(distanceValue - dim*vcl_pow(3,b)) << std::endl; + std::cout << "-> Tests diff : " << vcl_abs(distanceValue - dim * vcl_pow(3, b)) << std::endl; - if ( vcl_abs(distanceValue - dim*vcl_pow(3,b)) < epsilon ) - return EXIT_SUCCESS; - else - return EXIT_FAILURE; + if (vcl_abs(distanceValue - dim * vcl_pow(3, b)) < epsilon) return EXIT_SUCCESS; + else return EXIT_FAILURE; } - - diff --git a/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValueNew.cxx b/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValueNew.cxx index 6a4a437818..f8cb261a3a 100644 --- a/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValueNew.cxx +++ b/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValueNew.cxx @@ -18,25 +18,22 @@ =========================================================================*/ - #include <iostream> #include <cstdlib> #include "itkVariableLengthVector.h" #include "otbFlexibleDistanceWithMissingValue.h" -int otbFlexibleDistanceWithMissingValueNew( int argc, char * argv[] ) +int otbFlexibleDistanceWithMissingValueNew(int argc, char * argv[]) { - typedef itk::VariableLengthVector< double > VectorType; - typedef otb::Statistics::FlexibleDistanceWithMissingValue< VectorType > DistanceType; + typedef itk::VariableLengthVector<double> VectorType; + typedef otb::Statistics::FlexibleDistanceWithMissingValue<VectorType> DistanceType; float a = 1.0; float b = 0.1; - DistanceType::SetAlphaBeta(a,b); + DistanceType::SetAlphaBeta(a, b); DistanceType::Pointer dist = DistanceType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbFrostFilter.cxx b/Testing/Code/BasicFilters/otbFrostFilter.cxx index 75ecf3425d..72951a2638 100644 --- a/Testing/Code/BasicFilters/otbFrostFilter.cxx +++ b/Testing/Code/BasicFilters/otbFrostFilter.cxx @@ -28,50 +28,46 @@ #include "itkRandomImageSource.h" #include "itkMeanImageFilter.h" - -int otbFrostFilter( int argc, char * argv[] ) +int otbFrostFilter(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int RadiusX((unsigned int)::atoi(argv[3])); - unsigned int RadiusY((unsigned int)::atoi(argv[4])); - double Deramp ((double)::atof(argv[5])); + unsigned int RadiusX((unsigned int) ::atoi(argv[3])); + unsigned int RadiusY((unsigned int) ::atoi(argv[4])); + double Deramp ((double) ::atof(argv[5])); - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::FrostImageFilter< InputImageType,OutputImageType > FilterType; + typedef otb::FrostImageFilter<InputImageType, OutputImageType> FilterType; FilterType::SizeType Radius; - Radius[0]= RadiusX; - Radius[1]= RadiusY; + Radius[0] = RadiusX; + Radius[1] = RadiusY; FilterType::Pointer filterFrost = FilterType::New(); - filterFrost->SetRadius( Radius ); - filterFrost->SetDeramp( Deramp ); + filterFrost->SetRadius(Radius); + filterFrost->SetDeramp(Deramp); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - filterFrost->SetInput( reader->GetOutput() ); - writer->SetInput( filterFrost->GetOutput() ); + filterFrost->SetInput(reader->GetOutput()); + writer->SetInput(filterFrost->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbFrostFilterNew.cxx b/Testing/Code/BasicFilters/otbFrostFilterNew.cxx index f8276c2685..0d1cba2985 100644 --- a/Testing/Code/BasicFilters/otbFrostFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbFrostFilterNew.cxx @@ -28,20 +28,18 @@ #include "itkRandomImageSource.h" #include "itkMeanImageFilter.h" -int otbFrostFilterNew( int argc, char * argv[] ) +int otbFrostFilterNew(int argc, char * argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::FrostImageFilter< InputImageType,OutputImageType > FilterType; + typedef otb::FrostImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer frost = FilterType::New(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbFunctionToImageFilter.cxx b/Testing/Code/BasicFilters/otbFunctionToImageFilter.cxx index f25830a2df..fe0183c0b8 100644 --- a/Testing/Code/BasicFilters/otbFunctionToImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbFunctionToImageFilter.cxx @@ -25,12 +25,12 @@ int otbFunctionToImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; - typedef itk::VarianceImageFunction<InputImageType> FunctionType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; + typedef itk::VarianceImageFunction<InputImageType> FunctionType; typedef otb::FunctionToImageFilter<InputImageType, OutputImageType, FunctionType> FilterType; // Instantiating object @@ -40,7 +40,7 @@ int otbFunctionToImageFilter(int argc, char * argv[]) reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); FunctionType::Pointer function = FunctionType::New(); function->SetNeighborhoodRadius(atoi(argv[3])); @@ -48,7 +48,6 @@ int otbFunctionToImageFilter(int argc, char * argv[]) filter->SetFunction(function); - writer->SetInput(filter->GetOutput()); writer->SetNumberOfStreamDivisions(2); writer->Update(); diff --git a/Testing/Code/BasicFilters/otbFunctionToImageFilterNew.cxx b/Testing/Code/BasicFilters/otbFunctionToImageFilterNew.cxx index cb6292184a..83e902da56 100644 --- a/Testing/Code/BasicFilters/otbFunctionToImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbFunctionToImageFilterNew.cxx @@ -23,8 +23,8 @@ int otbFunctionToImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; typedef itk::VarianceImageFunction<ImageType> FunctionType; typedef otb::FunctionToImageFilter<ImageType, ImageType, FunctionType> FilterType; diff --git a/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilter.cxx b/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilter.cxx index d810dc310f..7fba78f9cb 100644 --- a/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilter.cxx @@ -26,18 +26,18 @@ template <class TScalarInput, class TScalarOutput> class ITK_EXPORT FunctorTest : -public otb::Functor::TextureFunctorBase<TScalarInput, TScalarOutput> + public otb::Functor::TextureFunctorBase<TScalarInput, TScalarOutput> { public: FunctorTest(){}; - ~FunctorTest(){}; + ~FunctorTest(){} - typedef itk::Neighborhood<TScalarInput, 2> NeighborhoodType; - - virtual double ComputeOverSingleChannel(const NeighborhoodType &neigh, const NeighborhoodType &neighOff) + typedef itk::Neighborhood<TScalarInput, 2> NeighborhoodType; + + virtual double ComputeOverSingleChannel(const NeighborhoodType& neigh, const NeighborhoodType& neighOff) { double out = neigh.GetCenterValue(); - + return out; } }; @@ -45,13 +45,13 @@ public: int otbFunctionWithNeighborhoodToImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputImageType; - typedef InputImageType::SizeType SizeType; - typedef InputImageType::OffsetType OffsetType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef InputImageType::SizeType SizeType; + typedef InputImageType::OffsetType OffsetType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; typedef FunctorTest<PixelType, PixelType> FunctorType; typedef otb::TextureImageFunction<InputImageType, FunctorType> FunctionType; typedef otb::FunctionWithNeighborhoodToImageFilter<InputImageType, OutputImageType, FunctionType> FilterType; @@ -60,7 +60,7 @@ int otbFunctionWithNeighborhoodToImageFilter(int argc, char * argv[]) FilterType::Pointer filter = FilterType::New(); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - + // jsut for accessors, the functor doesn't care SizeType radius; radius.Fill(2); @@ -69,13 +69,13 @@ int otbFunctionWithNeighborhoodToImageFilter(int argc, char * argv[]) reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); filter->SetRadius(radius); filter->SetOffset(offset); writer->SetInput(filter->GetOutput()); //writer->SetNumberOfStreamDivisions(1); writer->Update(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx b/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx index 36477ac787..a4f1481a44 100644 --- a/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx @@ -25,36 +25,35 @@ #include "itkOffset.h" //#include "otbTextureFunctorBase.h" -template <class TInputScalarType, class TOutputScalarType>//IterInput1, class TIterInput2, class TOutput> +template <class TInputScalarType, class TOutputScalarType> //IterInput1, class TIterInput2, class TOutput> class TextureFunctorTest { public: TextureFunctorTest() { m_Offset.Fill(1); - }; - ~TextureFunctorTest() {}; + } + ~TextureFunctorTest() {} - typedef itk::Offset<> OffsetType; - typedef itk::Neighborhood<TInputScalarType, 2> NeighborhoodType; - - void SetOffset(OffsetType off){ m_Offset=off; }; + typedef itk::Offset<> OffsetType; + typedef itk::Neighborhood<TInputScalarType, 2> NeighborhoodType; - inline TOutputScalarType operator()(const NeighborhoodType &neigh) - { - return static_cast<TOutputScalarType>(neigh.GetCenterValue()); - } + void SetOffset(OffsetType off){ m_Offset = off; } - private: + inline TOutputScalarType operator ()(const NeighborhoodType& neigh) + { + return static_cast<TOutputScalarType>(neigh.GetCenterValue()); + } + +private: OffsetType m_Offset; }; - int otbFunctionWithNeighborhoodToImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; typedef itk::VariableLengthVector<double> VectorType; typedef itk::ConstNeighborhoodIterator<ImageType> IteratorType; diff --git a/Testing/Code/BasicFilters/otbGaborFilterGenerator.cxx b/Testing/Code/BasicFilters/otbGaborFilterGenerator.cxx index a691e9abe3..d3edd5af9c 100644 --- a/Testing/Code/BasicFilters/otbGaborFilterGenerator.cxx +++ b/Testing/Code/BasicFilters/otbGaborFilterGenerator.cxx @@ -22,35 +22,35 @@ int otbGaborFilterGenerator(int argc, char * argv[]) { - if (argc!=10) - { - std::cerr<<"Usage: "<<argv[0]<<"outfname xradius yradius a b theta u0 v0 phi"<<std::endl; + if (argc != 10) + { + std::cerr << "Usage: " << argv[0] << "outfname xradius yradius a b theta u0 v0 phi" << std::endl; return EXIT_FAILURE; - } + } - const char * outfname = argv[1]; + const char * outfname = argv[1]; const unsigned int xradius = atoi(argv[2]); const unsigned int yradius = atoi(argv[3]); - const double a = atof(argv[4]); - const double b = atof(argv[5]); - const double theta = atof(argv[6]); - const double u0 = atof(argv[7]); - const double v0 = atof(argv[8]); - const double phi = atof(argv[9]); - - typedef double PrecisionType; + const double a = atof(argv[4]); + const double b = atof(argv[5]); + const double theta = atof(argv[6]); + const double u0 = atof(argv[7]); + const double v0 = atof(argv[8]); + const double phi = atof(argv[9]); + + typedef double PrecisionType; typedef otb::GaborFilterGenerator<PrecisionType> GaborGeneratorType; - typedef GaborGeneratorType::RadiusType RadiusType; - typedef GaborGeneratorType::ArrayType ArrayType; + typedef GaborGeneratorType::RadiusType RadiusType; + typedef GaborGeneratorType::ArrayType ArrayType; - typedef otb::Image<PrecisionType,2> ImageType; + typedef otb::Image<PrecisionType, 2> ImageType; typedef otb::ImageFileWriter<ImageType> WriterType; // Gabor filter generation GaborGeneratorType::Pointer gabor = GaborGeneratorType::New(); - RadiusType radius; - radius[0]=xradius; - radius[1]=yradius; + RadiusType radius; + radius[0] = xradius; + radius[1] = yradius; gabor->SetRadius(radius); gabor->SetA(a); gabor->SetB(b); @@ -61,11 +61,11 @@ int otbGaborFilterGenerator(int argc, char * argv[]) ArrayType filter = gabor->GetFilter(); // Writing filter mask to an image - ImageType::Pointer image = ImageType::New(); + ImageType::Pointer image = ImageType::New(); ImageType::RegionType region; - ImageType::SizeType size; - size[0]=2*radius[0]+1; - size[1]=2*radius[1]+1; + ImageType::SizeType size; + size[0] = 2 * radius[0] + 1; + size[1] = 2 * radius[1] + 1; ImageType::IndexType index; index.Fill(0); region.SetIndex(index); @@ -75,13 +75,13 @@ int otbGaborFilterGenerator(int argc, char * argv[]) image->Allocate(); image->FillBuffer(0); - itk::ImageRegionIterator<ImageType> it(image,region); - unsigned int k = 0; + itk::ImageRegionIterator<ImageType> it(image, region); + unsigned int k = 0; - for (it.GoToBegin();!it.IsAtEnd();++it,++k) - { + for (it.GoToBegin(); !it.IsAtEnd(); ++it, ++k) + { it.Set(filter[k]); - } + } WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outfname); diff --git a/Testing/Code/BasicFilters/otbGaborFilterGeneratorNew.cxx b/Testing/Code/BasicFilters/otbGaborFilterGeneratorNew.cxx index 41b942dbe6..e16381dc9c 100644 --- a/Testing/Code/BasicFilters/otbGaborFilterGeneratorNew.cxx +++ b/Testing/Code/BasicFilters/otbGaborFilterGeneratorNew.cxx @@ -20,7 +20,7 @@ int otbGaborFilterGeneratorNew(int argc, char * argv[]) { - typedef double PrecisionType; + typedef double PrecisionType; typedef otb::GaborFilterGenerator<PrecisionType> GaborGeneratorType; // Instantiating object diff --git a/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterNew.cxx b/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterNew.cxx index 5fe8e1ec1a..bdc9859fa8 100644 --- a/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterNew.cxx @@ -26,17 +26,14 @@ #include "otbVectorImage.h" #include "otbImageAndVectorImageOperationFilter.h" - -int otbImageAndVectorImageOperationFilterNew( int argc, char * argv[] ) +int otbImageAndVectorImageOperationFilterNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType, 2> ScalarImageType; - typedef otb::VectorImage<PixelType, 2> VectorImageType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ScalarImageType; + typedef otb::VectorImage<PixelType, 2> VectorImageType; typedef otb::ImageAndVectorImageOperationFilter<ScalarImageType, VectorImageType, VectorImageType> FilterType; FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterTest.cxx b/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterTest.cxx index 657a88a1a3..d3272a3d9e 100644 --- a/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterTest.cxx +++ b/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterTest.cxx @@ -28,15 +28,14 @@ #include "otbImageFileWriter.h" #include "otbImageAndVectorImageOperationFilter.h" - -int otbImageAndVectorImageOperationFilterTest( int argc, char * argv[] ) +int otbImageAndVectorImageOperationFilterTest(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * invectfname = argv[2]; - const char * outfnameAdd = argv[3]; - const char * outfnameSub = argv[4]; - const char * outfnameMul = argv[5]; - const char * outfnameDiv = argv[6]; + const char * infname = argv[1]; + const char * invectfname = argv[2]; + const char * outfnameAdd = argv[3]; + const char * outfnameSub = argv[4]; + const char * outfnameMul = argv[5]; + const char * outfnameDiv = argv[6]; typedef double PixelType; typedef otb::Image<PixelType, 2> ScalarImageType; @@ -44,7 +43,7 @@ int otbImageAndVectorImageOperationFilterTest( int argc, char * argv[] ) typedef otb::ImageFileReader<ScalarImageType> ReaderType; typedef otb::ImageFileReader<VectorImageType> VectorReaderType; typedef otb::ImageFileWriter<VectorImageType> WriterType; - + typedef otb::ImageAndVectorImageOperationFilter<ScalarImageType, VectorImageType, VectorImageType> FilterType; ReaderType::Pointer reader = ReaderType::New(); @@ -60,28 +59,26 @@ int otbImageAndVectorImageOperationFilterTest( int argc, char * argv[] ) filter->SetInput(reader->GetOutput()); filter->SetVectorInput(vectorReader->GetOutput()); - + filter->UseAddition(); - writerAdd->SetInput( filter->GetOutput() ); + writerAdd->SetInput(filter->GetOutput()); writerAdd->SetFileName(outfnameAdd); writerAdd->Update(); filter->UseSubstraction(); - writerSub->SetInput( filter->GetOutput() ); + writerSub->SetInput(filter->GetOutput()); writerSub->SetFileName(outfnameSub); writerSub->Update(); filter->UseMultiplication(); - writerMul->SetInput( filter->GetOutput() ); + writerMul->SetInput(filter->GetOutput()); writerMul->SetFileName(outfnameMul); writerMul->Update(); filter->UseDivision(); - writerDiv->SetInput( filter->GetOutput() ); + writerDiv->SetInput(filter->GetOutput()); writerDiv->SetFileName(outfnameDiv); writerDiv->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbImageListToImageListApplyFilter.cxx b/Testing/Code/BasicFilters/otbImageListToImageListApplyFilter.cxx index 23a28edd60..f5e30d777a 100644 --- a/Testing/Code/BasicFilters/otbImageListToImageListApplyFilter.cxx +++ b/Testing/Code/BasicFilters/otbImageListToImageListApplyFilter.cxx @@ -34,22 +34,22 @@ int otbImageListToImageListApplyFilter(int argc, char * argv[]) char * outfname3 = argv[6]; const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageList<ImageType> ImageListType; - typedef itk::MeanImageFilter<ImageType,ImageType> MeanFilterType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageList<ImageType> ImageListType; + typedef itk::MeanImageFilter<ImageType, ImageType> MeanFilterType; // IO typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::ImageListToImageListApplyFilter<ImageListType,ImageListType,MeanFilterType> + typedef otb::ImageListToImageListApplyFilter<ImageListType, ImageListType, MeanFilterType> ImageListToImageListApplyFilterType; // Instantiating object ImageListToImageListApplyFilterType::Pointer filter = ImageListToImageListApplyFilterType::New(); - ReaderType::Pointer reader1,reader2,reader3; + ReaderType::Pointer reader1, reader2, reader3; reader1 = ReaderType::New(); reader1->SetFileName(infname1); @@ -65,7 +65,6 @@ int otbImageListToImageListApplyFilter(int argc, char * argv[]) imageList->PushBack(reader2->GetOutput()); imageList->PushBack(reader3->GetOutput()); - MeanFilterType::Pointer meanFilter = MeanFilterType::New(); filter->SetInput(imageList); @@ -87,6 +86,5 @@ int otbImageListToImageListApplyFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()->GetNthElement(0)); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbImageListToImageListApplyFilterNew.cxx b/Testing/Code/BasicFilters/otbImageListToImageListApplyFilterNew.cxx index 573fc49d3e..0bff119fe9 100644 --- a/Testing/Code/BasicFilters/otbImageListToImageListApplyFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbImageListToImageListApplyFilterNew.cxx @@ -25,17 +25,16 @@ int otbImageListToImageListApplyFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageList<ImageType> ImageListType; - typedef itk::MeanImageFilter<ImageType,ImageType> MeanFilterType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageList<ImageType> ImageListType; + typedef itk::MeanImageFilter<ImageType, ImageType> MeanFilterType; - typedef otb::ImageListToImageListApplyFilter<ImageListType,ImageListType,MeanFilterType> + typedef otb::ImageListToImageListApplyFilter<ImageListType, ImageListType, MeanFilterType> ImageListToImageListApplyFilterType; // Instantiating object ImageListToImageListApplyFilterType::Pointer object = ImageListToImageListApplyFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbImageListToVectorImageFilter.cxx b/Testing/Code/BasicFilters/otbImageListToVectorImageFilter.cxx index 3ee4b2da78..27a145acdf 100644 --- a/Testing/Code/BasicFilters/otbImageListToVectorImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbImageListToVectorImageFilter.cxx @@ -34,15 +34,15 @@ int otbImageListToVectorImageFilter(int argc, char * argv[]) char * infname3 = argv[3]; char * outfname = argv[4]; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::ImageList<ImageType> ImageListType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::ImageList<ImageType> ImageListType; // IO - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileWriter<VectorImageType> WriterType; - typedef otb::ImageListToVectorImageFilter<ImageListType,VectorImageType> ImageListToVectorImageFilterType; + typedef otb::ImageListToVectorImageFilter<ImageListType, VectorImageType> ImageListToVectorImageFilterType; // Instantiating object ImageListToVectorImageFilterType::Pointer filter = ImageListToVectorImageFilterType::New(); @@ -72,6 +72,5 @@ int otbImageListToVectorImageFilter(int argc, char * argv[]) writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbImageListToVectorImageFilter2.cxx b/Testing/Code/BasicFilters/otbImageListToVectorImageFilter2.cxx index a4bb87df50..8003c68a75 100644 --- a/Testing/Code/BasicFilters/otbImageListToVectorImageFilter2.cxx +++ b/Testing/Code/BasicFilters/otbImageListToVectorImageFilter2.cxx @@ -23,7 +23,6 @@ #include "otbImageList.h" #include "otbImageFileReader.h" - int otbImageListToVectorImageFilter2(int argc, char * argv[]) { const unsigned int Dimension = 2; @@ -34,16 +33,16 @@ int otbImageListToVectorImageFilter2(int argc, char * argv[]) char * infname3 = argv[3]; // char * outfname = argv[4]; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; // typedef VectorImageType::Pointer VectorImagePointerType; typedef otb::ImageList<ImageType> ImageListType; - + // IO typedef otb::ImageFileReader<ImageType> ReaderType; // typedef otb::ImageFileWriter<VectorImageType> WriterType; - typedef otb::ImageListToVectorImageFilter<ImageListType,VectorImageType> ImageListToVectorImageFilterType; + typedef otb::ImageListToVectorImageFilter<ImageListType, VectorImageType> ImageListToVectorImageFilterType; // Instantiating object ImageListToVectorImageFilterType::Pointer filter = ImageListToVectorImageFilterType::New(); @@ -65,27 +64,25 @@ int otbImageListToVectorImageFilter2(int argc, char * argv[]) imageList->PushBack(reader1->GetOutput()); imageList->PushBack(reader2->GetOutput()); imageList->PushBack(reader3->GetOutput()); - + filter->SetInput(imageList); VectorImageType::Pointer m_OutputImage = VectorImageType::New(); m_OutputImage = filter->GetOutput(); - + m_OutputImage->UpdateOutputInformation(); - + unsigned int nbComp1 = m_OutputImage->GetNumberOfComponentsPerPixel(); - + imageList->PopBack(); m_OutputImage->UpdateOutputInformation(); - + unsigned int nbComp2 = m_OutputImage->GetNumberOfComponentsPerPixel (); std::cout << "component 1: " << nbComp1 << std::endl; std::cout << "component 2: " << nbComp2 << std::endl; - - if ( nbComp2 != nbComp1 - 1) - - return EXIT_FAILURE; - + + if (nbComp2 != nbComp1 - 1) return EXIT_FAILURE; + return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbImageListToVectorImageFilterNew.cxx b/Testing/Code/BasicFilters/otbImageListToVectorImageFilterNew.cxx index 8460882a1b..fc227f7db1 100644 --- a/Testing/Code/BasicFilters/otbImageListToVectorImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbImageListToVectorImageFilterNew.cxx @@ -27,15 +27,14 @@ int otbImageListToVectorImageFilterNew(int argc, char * argv[]) const unsigned int Dimension = 2; typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::ImageList<ImageType> ImageListType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::ImageList<ImageType> ImageListType; - typedef otb::ImageListToVectorImageFilter<ImageListType,VectorImageType> ImageListToVectorImageFilterType; + typedef otb::ImageListToVectorImageFilter<ImageListType, VectorImageType> ImageListToVectorImageFilterType; // Instantiating object ImageListToVectorImageFilterType::Pointer object = ImageListToVectorImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbImagePCAShapeModelEstimatorTest.cxx b/Testing/Code/BasicFilters/otbImagePCAShapeModelEstimatorTest.cxx index 38e34b5104..10b40f0d12 100644 --- a/Testing/Code/BasicFilters/otbImagePCAShapeModelEstimatorTest.cxx +++ b/Testing/Code/BasicFilters/otbImagePCAShapeModelEstimatorTest.cxx @@ -40,7 +40,6 @@ // class to support progress feeback - class ShowProgressObject { public: @@ -55,8 +54,7 @@ public: itk::LightProcessObject::Pointer m_Process; }; - -int otbImagePCAShapeModelEstimatorTest(int argc, char* argv[] ) +int otbImagePCAShapeModelEstimatorTest(int argc, char* argv[]) { /* const unsigned int numberOfPrincipalComponentsRequired(atoi(argv[1])); const unsigned int numberOfTrainingImages(atoi(argv[2])); @@ -74,22 +72,20 @@ int otbImagePCAShapeModelEstimatorTest(int argc, char* argv[] ) } */ - itk::OutputWindow::SetInstance(itk::TextOutput::New().GetPointer()); - //------------------------------------------------------ //Create 3 simple test images with //------------------------------------------------------ - typedef itk::Image<double,NDIMENSION> InputImageType; - typedef itk::Image<double,NDIMENSION> OutputImageType; + typedef itk::Image<double, NDIMENSION> InputImageType; + typedef itk::Image<double, NDIMENSION> OutputImageType; typedef - itk::ImageRegionIterator< InputImageType > InputImageIterator; + itk::ImageRegionIterator<InputImageType> InputImageIterator; typedef - itk::ImageRegionIterator< OutputImageType > OutputImageIterator; + itk::ImageRegionIterator<OutputImageType> OutputImageIterator; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; // Instantiating object @@ -122,27 +118,27 @@ int otbImagePCAShapeModelEstimatorTest(int argc, char* argv[] ) ImagePCAShapeModelEstimatorType; ImagePCAShapeModelEstimatorType::Pointer - applyPCAShapeEstimator = ImagePCAShapeModelEstimatorType::New(); + applyPCAShapeEstimator = ImagePCAShapeModelEstimatorType::New(); //---------------------------------------------------------------------- //Set the parameters of the clusterer //---------------------------------------------------------------------- - applyPCAShapeEstimator->SetNumberOfTrainingImages( NUMTRAINIMAGES ); - applyPCAShapeEstimator->SetNumberOfPrincipalComponentsRequired( NUMLARGESTPC + 1 ); - applyPCAShapeEstimator->SetNumberOfPrincipalComponentsRequired( NUMLARGESTPC ); - applyPCAShapeEstimator->SetInput(0, reader1->GetOutput() ); - applyPCAShapeEstimator->SetInput(1, reader2->GetOutput() ); - applyPCAShapeEstimator->SetInput(2, reader3->GetOutput() ); + applyPCAShapeEstimator->SetNumberOfTrainingImages(NUMTRAINIMAGES); + applyPCAShapeEstimator->SetNumberOfPrincipalComponentsRequired(NUMLARGESTPC + 1); + applyPCAShapeEstimator->SetNumberOfPrincipalComponentsRequired(NUMLARGESTPC); + applyPCAShapeEstimator->SetInput(0, reader1->GetOutput()); + applyPCAShapeEstimator->SetInput(1, reader2->GetOutput()); + applyPCAShapeEstimator->SetInput(2, reader3->GetOutput()); applyPCAShapeEstimator->Update(); - writer1->SetInput(applyPCAShapeEstimator->GetOutput( 0 )); + writer1->SetInput(applyPCAShapeEstimator->GetOutput(0)); writer1->Update(); - writer2->SetInput(applyPCAShapeEstimator->GetOutput( 1 )); + writer2->SetInput(applyPCAShapeEstimator->GetOutput(1)); writer2->Update(); - writer3->SetInput(applyPCAShapeEstimator->GetOutput( 2 )); + writer3->SetInput(applyPCAShapeEstimator->GetOutput(2)); writer3->Update(); - writer4->SetInput(applyPCAShapeEstimator->GetOutput( 3 )); + writer4->SetInput(applyPCAShapeEstimator->GetOutput(3)); writer4->Update(); //Test the printself function to increase coverage @@ -155,10 +151,10 @@ int otbImagePCAShapeModelEstimatorTest(int argc, char* argv[] ) //Print out the number of training images and the number of principal //components std::cout << "The number of training images are: " << - applyPCAShapeEstimator->GetNumberOfTrainingImages() << std::endl; + applyPCAShapeEstimator->GetNumberOfTrainingImages() << std::endl; std::cout << "The number of principal components desired are: " << - applyPCAShapeEstimator->GetNumberOfPrincipalComponentsRequired() << std::endl; + applyPCAShapeEstimator->GetNumberOfPrincipalComponentsRequired() << std::endl; //Print the eigen vectors vnl_vector<double> eigenValues = @@ -167,13 +163,13 @@ int otbImagePCAShapeModelEstimatorTest(int argc, char* argv[] ) std::cout << "Number of returned eign-values: " << numEigVal << std::endl; std::cout << "The " << - applyPCAShapeEstimator->GetNumberOfPrincipalComponentsRequired() << - " largest eigen values are:" << std::endl; + applyPCAShapeEstimator->GetNumberOfPrincipalComponentsRequired() << + " largest eigen values are:" << std::endl; - for (unsigned int i= 0; i< vnl_math_min( numEigVal, (unsigned int)NUMLARGESTPC ); i++ ) - { - std::cout << eigenValues[ i ] << std::endl; - } + for (unsigned int i = 0; i < vnl_math_min(numEigVal, (unsigned int) NUMLARGESTPC); i++) + { + std::cout << eigenValues[i] << std::endl; + } //Print the MeanImage /* diff --git a/Testing/Code/BasicFilters/otbImageToPointSetFilterTest.cxx b/Testing/Code/BasicFilters/otbImageToPointSetFilterTest.cxx index c969d60d7b..e1f7a6eeb8 100644 --- a/Testing/Code/BasicFilters/otbImageToPointSetFilterTest.cxx +++ b/Testing/Code/BasicFilters/otbImageToPointSetFilterTest.cxx @@ -24,19 +24,17 @@ #include "itkImage.h" #include "itkPointSet.h" -int otbImageToPointSetFilterTest(int argc, char *argv[] ) +int otbImageToPointSetFilterTest(int argc, char *argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; + typedef unsigned char PixelType; - typedef itk::Image< PixelType, Dimension > ImageType; - typedef itk::PointSet<PixelType, Dimension> PointSetType; - typedef otb::ImageToPointSetFilter<ImageType,PointSetType> FunctionType; + typedef itk::Image<PixelType, Dimension> ImageType; + typedef itk::PointSet<PixelType, Dimension> PointSetType; + typedef otb::ImageToPointSetFilter<ImageType, PointSetType> FunctionType; //FunctionType::Pointer function = FunctionType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbImportGeoInformationImageFilter.cxx b/Testing/Code/BasicFilters/otbImportGeoInformationImageFilter.cxx index 04f3f30cf1..533d60f867 100644 --- a/Testing/Code/BasicFilters/otbImportGeoInformationImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbImportGeoInformationImageFilter.cxx @@ -28,18 +28,17 @@ int otbImportGeoInformationImageFilter(int argc, char * argv[]) const char * outfname = argv[2]; const unsigned int Dimension = 2; - typedef unsigned int PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::ImportGeoInformationImageFilter<ImageType,ImageType> ImportGeoInformationImageFilterType; + typedef unsigned int PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::ImportGeoInformationImageFilter<ImageType, ImageType> ImportGeoInformationImageFilterType; // Instantiating objects - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); ImportGeoInformationImageFilterType::Pointer import = ImportGeoInformationImageFilterType::New(); - reader->SetFileName(infname); reader->GenerateOutputInformation(); ImageType::IndexType index; @@ -51,18 +50,16 @@ int otbImportGeoInformationImageFilter(int argc, char * argv[]) black->SetRegions(region); black->Allocate(); black->FillBuffer(128); - std::cout<<"black: " <<black->GetLargestPossibleRegion()<<std::endl; + std::cout << "black: " << black->GetLargestPossibleRegion() << std::endl; import->SetInput(black); import->SetSource(reader->GetOutput()); // import->Update(); // std::cout<<"import output: "<<import->GetOutput()<<std::endl; - writer->SetFileName(outfname); writer->SetInput(import->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterNew.cxx b/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterNew.cxx index f0880d4a96..118e549586 100644 --- a/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterNew.cxx @@ -23,13 +23,12 @@ int otbImportGeoInformationImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImportGeoInformationImageFilter<ImageType,ImageType> ImportGeoInformationImageFilterType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImportGeoInformationImageFilter<ImageType, ImageType> ImportGeoInformationImageFilterType; // Instantiating object ImportGeoInformationImageFilterType::Pointer object = ImportGeoInformationImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterWithKeywordList.cxx b/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterWithKeywordList.cxx index a8caa506d3..f7438c2cea 100644 --- a/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterWithKeywordList.cxx +++ b/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterWithKeywordList.cxx @@ -28,16 +28,15 @@ int otbImportGeoInformationImageFilterWithKeywordList(int argc, char * argv[]) const char * outputAsciiFilenameOtbImage = argv[2]; const unsigned int Dimension = 2; - typedef unsigned int PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImportGeoInformationImageFilter<ImageType,ImageType> ImportGeoInformationImageFilterType; + typedef unsigned int PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImportGeoInformationImageFilter<ImageType, ImageType> ImportGeoInformationImageFilterType; // Instantiating objects - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImportGeoInformationImageFilterType::Pointer import = ImportGeoInformationImageFilterType::New(); - reader->SetFileName(infname); reader->GenerateOutputInformation(); ImageType::IndexType index; @@ -51,7 +50,7 @@ int otbImportGeoInformationImageFilterWithKeywordList(int argc, char * argv[]) black->SetRegions(region); black->Allocate(); black->FillBuffer(128); - std::cout<<"black: " <<black->GetLargestPossibleRegion()<<std::endl; + std::cout << "black: " << black->GetLargestPossibleRegion() << std::endl; import->SetInput(black); import->SetSource(reader->GetOutput()); @@ -63,7 +62,7 @@ int otbImportGeoInformationImageFilterWithKeywordList(int argc, char * argv[]) ossimKeywordlist ossim_kwl_image; otb_tmp_image.convertToOSSIMKeywordlist(ossim_kwl_image); - std::cout << " -> otbImage Ossim key word list copy : "<<ossim_kwl_image<<std::endl; + std::cout << " -> otbImage Ossim key word list copy : " << ossim_kwl_image << std::endl; std::ofstream file; file.open(outputAsciiFilenameOtbImage); @@ -71,6 +70,5 @@ int otbImportGeoInformationImageFilterWithKeywordList(int argc, char * argv[]) file << ossim_kwl_image; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbInnerProductPCAImageFilter.cxx b/Testing/Code/BasicFilters/otbInnerProductPCAImageFilter.cxx index abc38f537e..2c3370a7ef 100644 --- a/Testing/Code/BasicFilters/otbInnerProductPCAImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbInnerProductPCAImageFilter.cxx @@ -22,29 +22,29 @@ #include "otbInnerProductPCAImageFilter.h" #include "otbMultiToMonoChannelExtractROI.h" -int otbInnerProductPCAImageFilter( int argc, char* argv[] ) +int otbInnerProductPCAImageFilter(int argc, char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; - const char * inputFileName = argv[1]; - const char * outputFilename = argv[2]; - const bool generateMeanComponent(atoi(argv[3])); - const bool centerdata = atoi(argv[4]); + const char * inputFileName = argv[1]; + const char * outputFilename = argv[2]; + const bool generateMeanComponent(atoi(argv[3])); + const bool centerdata = atoi(argv[4]); const unsigned int numberOfPrincipalComponentsRequired(atoi(argv[5])); - typedef otb::Image<PixelType,Dimension> MonoImageType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::StreamingImageFileWriter< ImageType > WriterType; - typedef otb::StreamingImageFileWriter< MonoImageType > WriterType2; - typedef otb::InnerProductPCAImageFilter<ImageType,ImageType> PCAFilterType; + typedef otb::Image<PixelType, Dimension> MonoImageType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::StreamingImageFileWriter<MonoImageType> WriterType2; + typedef otb::InnerProductPCAImageFilter<ImageType, ImageType> PCAFilterType; - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFilename); - PCAFilterType::Pointer pcafilter = PCAFilterType::New(); + PCAFilterType::Pointer pcafilter = PCAFilterType::New(); pcafilter->SetNumberOfPrincipalComponentsRequired(numberOfPrincipalComponentsRequired); pcafilter->SetGenerateMeanComponent(generateMeanComponent); @@ -53,21 +53,21 @@ int otbInnerProductPCAImageFilter( int argc, char* argv[] ) writer->SetInput(pcafilter->GetOutput()); writer->Update(); - typedef otb::MultiToMonoChannelExtractROI< PixelType, PixelType > ExtractROIFilterType; + typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType> ExtractROIFilterType; unsigned int nbComponents = numberOfPrincipalComponentsRequired; if (generateMeanComponent == true) nbComponents += 1; - for(unsigned int cpt=0; cpt < nbComponents; cpt++) - { + for (unsigned int cpt = 0; cpt < nbComponents; cpt++) + { ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - WriterType2::Pointer writer2 = WriterType2::New(); + WriterType2::Pointer writer2 = WriterType2::New(); extractROIFilter->SetInput(pcafilter->GetOutput()); - extractROIFilter->SetChannel(cpt+1); + extractROIFilter->SetChannel(cpt + 1); writer2->SetInput(extractROIFilter->GetOutput()); - writer2->SetFileName(argv[cpt+6]); + writer2->SetFileName(argv[cpt + 6]); writer2->Update(); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbInnerProductPCAImageFilterNew.cxx b/Testing/Code/BasicFilters/otbInnerProductPCAImageFilterNew.cxx index 82def92e80..f25de1c1ef 100644 --- a/Testing/Code/BasicFilters/otbInnerProductPCAImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbInnerProductPCAImageFilterNew.cxx @@ -18,14 +18,14 @@ #include "otbInnerProductPCAImageFilter.h" #include "otbVectorImage.h" -int otbInnerProductPCAImageFilterNew( int argc, char* argv[] ) +int otbInnerProductPCAImageFilterNew(int argc, char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; // Typedef - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::InnerProductPCAImageFilter<ImageType,ImageType> FilterType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::InnerProductPCAImageFilter<ImageType, ImageType> FilterType; // Instantiation object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx b/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx index f903a39a4c..c2ac8c727c 100644 --- a/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx +++ b/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx @@ -23,69 +23,68 @@ int otbInverseLogPolarTransform(int argc, char* argv[]) { - double radialStep = atof(argv[1]); - double angularStep = atof(argv[2]); + double radialStep = atof(argv[1]); + double angularStep = atof(argv[2]); const char * outputFilename(argv[3]); unsigned int nbPoints = atoi(argv[4]); - typedef double PrecisionType; + typedef double PrecisionType; typedef otb::InverseLogPolarTransform<PrecisionType> InverseLogPolarTransformType; - typedef itk::Point<PrecisionType,2> PointType; - typedef std::vector<PointType> PointsVectorType; + typedef itk::Point<PrecisionType, 2> PointType; + typedef std::vector<PointType> PointsVectorType; std::ofstream file; file.open(outputFilename); - file << "input points retrieval : "<<std::endl; + file << "input points retrieval : " << std::endl; // input points retrieval PointsVectorType vect; - for (unsigned int i=0;i<nbPoints;++i) - { + for (unsigned int i = 0; i < nbPoints; ++i) + { PointType p; - p[0]=atof(argv[5+2*i]); - p[1]=atof(argv[6+2*i]); - file <<"Adding point "<<p<<"."<<std::endl; + p[0] = atof(argv[5 + 2 * i]); + p[1] = atof(argv[6 + 2 * i]); + file << "Adding point " << p << "." << std::endl; vect.push_back(p); - } + } // Instantiation - InverseLogPolarTransformType::Pointer transform = InverseLogPolarTransformType::New(); + InverseLogPolarTransformType::Pointer transform = InverseLogPolarTransformType::New(); InverseLogPolarTransformType::ParametersType params(4); - params[0]=0.; - params[1]=0.; - params[2]=radialStep; - params[3]=angularStep; + params[0] = 0.; + params[1] = 0.; + params[2] = radialStep; + params[3] = angularStep; transform->SetParameters(params); - file << "Transform calculation ... :" <<std::endl; + file << "Transform calculation ... :" << std::endl; - for (PointsVectorType::iterator it=vect.begin();it!=vect.end();++it) - { + for (PointsVectorType::iterator it = vect.begin(); it != vect.end(); ++it) + { PointType p = transform->TransformPoint(*it); PointType pprime; - double rho = vcl_sqrt((*it)[0]*(*it)[0]+(*it)[1]*(*it)[1]); + double rho = vcl_sqrt((*it)[0] * (*it)[0] + (*it)[1] * (*it)[1]); - if (rho>0) - { - pprime[0]=(1./angularStep)*vcl_asin((*it)[1]/rho); - pprime[0]=pprime[0]*(180./ otb::CONST_PI); + if (rho > 0) + { + pprime[0] = (1. / angularStep) * vcl_asin((*it)[1] / rho); + pprime[0] = pprime[0] * (180. / otb::CONST_PI); // Deplacing the range to [0,90], [270,360] - pprime[0]= pprime[0]>0. ? pprime[0] : pprime[0]+360.; + pprime[0] = pprime[0] > 0. ? pprime[0] : pprime[0] + 360.; // Avoiding asin indetermination - if (p[0]>=0) - { - pprime[0]=pprime[0]<90. ? pprime[0]+90. : pprime[0]-90.; + if (p[0] >= 0) + { + pprime[0] = pprime[0] < 90. ? pprime[0] + 90. : pprime[0] - 90.; + } + pprime[1] = (1. / radialStep) * vcl_log(rho); } - pprime[1]=(1./radialStep)*vcl_log(rho); - } else - { - pprime[0]=400.; - pprime[1]=0.; - } + { + pprime[0] = 400.; + pprime[1] = 0.; + } - file <<"Original Point: "<<(*it)<<", Reference point: "<<pprime<<", Transformed point: "<<p<<std::endl; - } + file << "Original Point: " << (*it) << ", Reference point: " << pprime << ", Transformed point: " << p << std::endl; + } file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbInverseLogPolarTransformNew.cxx b/Testing/Code/BasicFilters/otbInverseLogPolarTransformNew.cxx index 4cdf56cb06..ee087fb440 100644 --- a/Testing/Code/BasicFilters/otbInverseLogPolarTransformNew.cxx +++ b/Testing/Code/BasicFilters/otbInverseLogPolarTransformNew.cxx @@ -20,12 +20,11 @@ int otbInverseLogPolarTransformNew(int argc, char* argv[]) { - typedef double PrecisionType; + typedef double PrecisionType; typedef otb::InverseLogPolarTransform<PrecisionType> InverseLogPolarTransformType; // Instantiation InverseLogPolarTransformType::Pointer transform = InverseLogPolarTransformType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbInverseLogPolarTransformResample.cxx b/Testing/Code/BasicFilters/otbInverseLogPolarTransformResample.cxx index 71fb1ed1d6..5c3d144626 100644 --- a/Testing/Code/BasicFilters/otbInverseLogPolarTransformResample.cxx +++ b/Testing/Code/BasicFilters/otbInverseLogPolarTransformResample.cxx @@ -29,17 +29,15 @@ int otbInverseLogPolarTransformResample(int argc, char* argv[]) char * inputFileName = argv[1]; char * outputFileName = argv[2]; - const unsigned int Dimension = 2; - typedef double PrecisionType; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::InverseLogPolarTransform<PrecisionType> InverseLogPolarTransformType; - typedef itk::LinearInterpolateImageFunction<ImageType,PrecisionType> InterpolatorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::ResampleImageFilter<ImageType,ImageType,PrecisionType> ResampleFilterType; - + typedef double PrecisionType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::InverseLogPolarTransform<PrecisionType> InverseLogPolarTransformType; + typedef itk::LinearInterpolateImageFunction<ImageType, PrecisionType> InterpolatorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::ResampleImageFilter<ImageType, ImageType, PrecisionType> ResampleFilterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); @@ -48,24 +46,23 @@ int otbInverseLogPolarTransformResample(int argc, char* argv[]) InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetInputImage(reader->GetOutput()); - std::cout<<interpolator<<std::endl; + std::cout << interpolator << std::endl; InverseLogPolarTransformType::Pointer transform = InverseLogPolarTransformType::New(); ImageType::SizeType size; - size[0]=720; - size[1]=540; - + size[0] = 720; + size[1] = 540; InverseLogPolarTransformType::ParametersType params(4); // Center the transform - params[0]=0.5*static_cast<double>(size[0]); - params[1]=0.5*static_cast<double>(size[1]); - params[2]=360./reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]; - params[3]=vcl_log(vcl_sqrt(vcl_pow(static_cast<double>(size[0]),2.) - +vcl_pow(static_cast<double>(size[1]),2.))/2)/reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]; + params[0] = 0.5 * static_cast<double>(size[0]); + params[1] = 0.5 * static_cast<double>(size[1]); + params[2] = 360. / reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]; + params[3] = vcl_log(vcl_sqrt(vcl_pow(static_cast<double>(size[0]), 2.) + + vcl_pow(static_cast<double>(size[1]), + 2.)) / 2) / reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]; transform->SetParameters(params); - // ImageType::SpacingType spacing; // spacing.Fill(1.0); @@ -81,6 +78,5 @@ int otbInverseLogPolarTransformResample(int argc, char* argv[]) writer->SetInput(resampler->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterNew.cxx b/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterNew.cxx index 4e749e3699..4c03bfa817 100644 --- a/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterNew.cxx @@ -24,23 +24,22 @@ #include "itkVariableLengthVector.h" #include "otbImage.h" -int otbKeyPointDensityImageFilterNew(int, char* [] ) +int otbKeyPointDensityImageFilterNew(int, char*[]) { - const unsigned int Dimension = 2; - typedef float PixelType; + const unsigned int Dimension = 2; + typedef float PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef ImageType::IndexType IndexType; - typedef itk::VariableLengthVector<PixelType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> DetectorType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef ImageType::IndexType IndexType; + typedef itk::VariableLengthVector<PixelType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> DetectorType; - typedef otb::KeyPointDensityImageFilter< ImageType, ImageType, DetectorType> FilterType; + typedef otb::KeyPointDensityImageFilter<ImageType, ImageType, DetectorType> FilterType; /**Instantiation of an object*/ - FilterType::Pointer filter = FilterType::New(); + FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx b/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx index d17c6f2bdc..d81529497a 100644 --- a/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx +++ b/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx @@ -27,42 +27,40 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbKeyPointDensityImageFilterTest(int argc, char* argv[] ) +int otbKeyPointDensityImageFilterTest(int argc, char* argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; + const char * infname = argv[1]; + const char * outfname = argv[2]; const unsigned int scales = atoi(argv[3]); const unsigned int octaves = atoi(argv[4]); const unsigned int radius = atoi(argv[5]); - const unsigned int Dimension = 2; - typedef float PixelType; + const unsigned int Dimension = 2; + typedef float PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef ImageType::IndexType IndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::VariableLengthVector<PixelType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> DetectorType; - - typedef otb::KeyPointDensityImageFilter< ImageType, ImageType, DetectorType> FilterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef ImageType::IndexType IndexType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::VariableLengthVector<PixelType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> DetectorType; + typedef otb::KeyPointDensityImageFilter<ImageType, ImageType, DetectorType> FilterType; /**Instantiation of an object*/ - FilterType::Pointer filter = FilterType::New(); - DetectorType::Pointer detector = DetectorType::New(); - ReaderType::Pointer reader = ReaderType::New(); + FilterType::Pointer filter = FilterType::New(); + DetectorType::Pointer detector = DetectorType::New(); + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); reader->GenerateOutputInformation(); filter->SetInput(reader->GetOutput()); detector = filter->GetDetector(); - detector ->SetOctavesNumber(octaves); + detector->SetOctavesNumber(octaves); detector->SetScalesNumber(scales); - filter->SetDetector(detector); filter->SetNeighborhoodRadius(radius); @@ -72,7 +70,5 @@ int otbKeyPointDensityImageFilterTest(int argc, char* argv[] ) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilter.cxx b/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilter.cxx index 3d3e541bef..6a343b68b9 100644 --- a/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilter.cxx @@ -31,27 +31,27 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLabelizeConfidenceConnectedImageFilter( int argc, char * argv[] ) +int otbLabelizeConfidenceConnectedImageFilter(int argc, char * argv[]) { // Arguments char* inputImageName = argv[1]; char* outputImageName = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; typedef itk::RGBPixel<unsigned char> ColorPixelType; const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::Image<ColorPixelType, Dimension> RGBImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::Image<ColorPixelType, Dimension> RGBImageType; - InputPixelType lowerThreshold( (InputPixelType)::atoi(argv[3]) ); - InputPixelType upperThreshold( (InputPixelType)::atoi(argv[4]) ); + InputPixelType lowerThreshold((InputPixelType) ::atoi(argv[3])); + InputPixelType upperThreshold((InputPixelType) ::atoi(argv[4])); - double multiplier = (double)( atof(argv[5]) ); - unsigned int numberOfIterations = (unsigned int)(atoi(argv[6])); - unsigned int initialRadius = (unsigned int)(atoi(argv[7])); + double multiplier = (double) (atof(argv[5])); + unsigned int numberOfIterations = (unsigned int) (atoi(argv[6])); + unsigned int initialRadius = (unsigned int) (atoi(argv[7])); // Reader typedef otb::ImageFileReader<InputImageType> ReaderType; @@ -80,7 +80,7 @@ int otbLabelizeConfidenceConnectedImageFilter( int argc, char * argv[] ) rescaler->SetOutputMaximum(255); // Label to RGB image - typedef itk::Functor::ScalarToRGBPixelFunctor<OutputPixelType> FunctorType; + typedef itk::Functor::ScalarToRGBPixelFunctor<OutputPixelType> FunctorType; typedef itk::UnaryFunctorImageFilter<OutputImageType, RGBImageType, FunctorType> ColorLabelFilterType; ColorLabelFilterType::Pointer labelToRGB = ColorLabelFilterType::New(); diff --git a/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilterNew.cxx b/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilterNew.cxx index c355de5ee5..89e1671476 100644 --- a/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilterNew.cxx @@ -22,13 +22,13 @@ #include "otbLabelizeConfidenceConnectedImageFilter.h" #include "otbImage.h" -int otbLabelizeConfidenceConnectedImageFilterNew( int argc, char * argv[] ) +int otbLabelizeConfidenceConnectedImageFilterNew(int argc, char * argv[]) { typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; typedef otb::Image<OutputPixelType, Dimension> OutputImageType; typedef otb::LabelizeConfidenceConnectedImageFilter diff --git a/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilter.cxx b/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilter.cxx index 3ce09e5ac4..bea5341dc1 100644 --- a/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilter.cxx @@ -30,27 +30,26 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLabelizeConnectedThresholdImageFilter( int argc, char * argv[] ) +int otbLabelizeConnectedThresholdImageFilter(int argc, char * argv[]) { // Arguments char* inputImageName = argv[1]; char* outputImageName = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; typedef itk::RGBPixel<unsigned char> ColorPixelType; const unsigned int Dimension = 2; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::Image<ColorPixelType, Dimension> RGBImageType; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::Image<ColorPixelType, Dimension> RGBImageType; - - InputPixelType lowerThreshold( (InputPixelType)::atoi(argv[3]) ); - InputPixelType upperThreshold( (InputPixelType)::atoi(argv[4]) ); - InputPixelType deltaLower( (InputPixelType)::atoi(argv[5]) ); - InputPixelType deltaUpper( (InputPixelType)::atoi(argv[6]) ); + InputPixelType lowerThreshold((InputPixelType) ::atoi(argv[3])); + InputPixelType upperThreshold((InputPixelType) ::atoi(argv[4])); + InputPixelType deltaLower((InputPixelType) ::atoi(argv[5])); + InputPixelType deltaUpper((InputPixelType) ::atoi(argv[6])); // Reader typedef otb::ImageFileReader<InputImageType> ReaderType; @@ -72,11 +71,10 @@ int otbLabelizeConnectedThresholdImageFilter( int argc, char * argv[] ) filter->SetUpperThresholdDelta(deltaUpper); // Label to RGB image - typedef itk::Functor::ScalarToRGBPixelFunctor<OutputPixelType> FunctorType; + typedef itk::Functor::ScalarToRGBPixelFunctor<OutputPixelType> FunctorType; typedef itk::UnaryFunctorImageFilter<OutputImageType, RGBImageType, FunctorType> ColorLabelFilterType; ColorLabelFilterType::Pointer labelToRGB = ColorLabelFilterType::New(); - filter->SetInput(reader->GetOutput()); labelToRGB->SetInput(filter->GetOutput()); writer->SetInput(labelToRGB->GetOutput()); diff --git a/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilterNew.cxx b/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilterNew.cxx index b542aabff2..087a981262 100644 --- a/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilterNew.cxx @@ -22,13 +22,13 @@ #include "otbLabelizeConnectedThresholdImageFilter.h" #include "otbImage.h" -int otbLabelizeConnectedThresholdImageFilterNew( int argc, char * argv[] ) +int otbLabelizeConnectedThresholdImageFilterNew(int argc, char * argv[]) { typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; typedef otb::Image<OutputPixelType, Dimension> OutputImageType; typedef otb::LabelizeConnectedThresholdImageFilter diff --git a/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilter.cxx b/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilter.cxx index a869a9ef99..310d628468 100644 --- a/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilter.cxx @@ -30,25 +30,25 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLabelizeNeighborhoodConnectedImageFilter( int argc, char * argv[] ) +int otbLabelizeNeighborhoodConnectedImageFilter(int argc, char * argv[]) { // Arguments char* inputImageName = argv[1]; char* outputImageName = argv[2]; - typedef unsigned short InputPixelType; - typedef unsigned char OutputPixelType; + typedef unsigned short InputPixelType; + typedef unsigned char OutputPixelType; typedef itk::RGBPixel<unsigned char> ColorPixelType; const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::Image<ColorPixelType, Dimension> RGBImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::Image<ColorPixelType, Dimension> RGBImageType; - InputPixelType lowerThreshold( (InputPixelType)::atoi(argv[3]) ); - InputPixelType upperThreshold( (InputPixelType)::atoi(argv[4]) ); - InputPixelType deltaLower( (InputPixelType)::atoi(argv[5]) ); - InputPixelType deltaUpper( (InputPixelType)::atoi(argv[6]) ); + InputPixelType lowerThreshold((InputPixelType) ::atoi(argv[3])); + InputPixelType upperThreshold((InputPixelType) ::atoi(argv[4])); + InputPixelType deltaLower((InputPixelType) ::atoi(argv[5])); + InputPixelType deltaUpper((InputPixelType) ::atoi(argv[6])); // Reader typedef otb::ImageFileReader<InputImageType> ReaderType; @@ -70,11 +70,10 @@ int otbLabelizeNeighborhoodConnectedImageFilter( int argc, char * argv[] ) filter->SetUpperThresholdDelta(deltaUpper); // Label to RGB image - typedef itk::Functor::ScalarToRGBPixelFunctor<OutputPixelType> FunctorType; + typedef itk::Functor::ScalarToRGBPixelFunctor<OutputPixelType> FunctorType; typedef itk::UnaryFunctorImageFilter<OutputImageType, RGBImageType, FunctorType> ColorLabelFilterType; ColorLabelFilterType::Pointer labelToRGB = ColorLabelFilterType::New(); - filter->SetInput(reader->GetOutput()); labelToRGB->SetInput(filter->GetOutput()); writer->SetInput(labelToRGB->GetOutput()); diff --git a/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilterNew.cxx b/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilterNew.cxx index ea53e65fed..2b6b9ba7c2 100644 --- a/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilterNew.cxx @@ -22,13 +22,13 @@ #include "otbLabelizeNeighborhoodConnectedImageFilter.h" #include "otbImage.h" -int otbLabelizeNeighborhoodConnectedImageFilterNew( int argc, char * argv[] ) +int otbLabelizeNeighborhoodConnectedImageFilterNew(int argc, char * argv[]) { typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; typedef otb::Image<OutputPixelType, Dimension> OutputImageType; typedef otb::LabelizeNeighborhoodConnectedImageFilter diff --git a/Testing/Code/BasicFilters/otbLeeFilter.cxx b/Testing/Code/BasicFilters/otbLeeFilter.cxx index abfc512882..be7588f4ae 100644 --- a/Testing/Code/BasicFilters/otbLeeFilter.cxx +++ b/Testing/Code/BasicFilters/otbLeeFilter.cxx @@ -27,51 +27,47 @@ #include "otbImageFileWriter.h" #include "otbLeeImageFilter.h" - -int otbLeeFilter( int argc, char * argv[] ) +int otbLeeFilter(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int RadiusX((unsigned int)::atoi(argv[3])); - unsigned int RadiusY((unsigned int)::atoi(argv[4])); - double NbLooks((double)::atof(argv[5])); + unsigned int RadiusX((unsigned int) ::atoi(argv[3])); + unsigned int RadiusY((unsigned int) ::atoi(argv[4])); + double NbLooks((double) ::atof(argv[5])); - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::LeeImageFilter< InputImageType,OutputImageType > FilterType; + typedef otb::LeeImageFilter<InputImageType, OutputImageType> FilterType; FilterType::SizeType Radius; - Radius[0]= RadiusX; - Radius[1]= RadiusY; + Radius[0] = RadiusX; + Radius[1] = RadiusY; FilterType::Pointer filterLee = FilterType::New(); - filterLee->SetRadius( Radius ); + filterLee->SetRadius(Radius); // OTB-FA-00018-CS filterLee->SetNbLooks(NbLooks); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - filterLee->SetInput( reader->GetOutput() ); - writer->SetInput( filterLee->GetOutput() ); + filterLee->SetInput(reader->GetOutput()); + writer->SetInput(filterLee->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbListSampleToHistogramListGenerator.cxx b/Testing/Code/BasicFilters/otbListSampleToHistogramListGenerator.cxx index 6bd2c413bb..3af29c167f 100644 --- a/Testing/Code/BasicFilters/otbListSampleToHistogramListGenerator.cxx +++ b/Testing/Code/BasicFilters/otbListSampleToHistogramListGenerator.cxx @@ -28,25 +28,25 @@ int otbListSampleToHistogramListGenerator(int argc, char * argv[]) typedef VectorImageType::PixelType VectorPixelType; typedef itk::Statistics::ListSample<VectorPixelType> ListSampleType; typedef otb::ListSampleToHistogramListGenerator - <ListSampleType,PixelType> HistogramGeneratorType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; + <ListSampleType, PixelType> HistogramGeneratorType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; // Instantiation ReaderType::Pointer reader = ReaderType::New(); HistogramGeneratorType::Pointer generator = HistogramGeneratorType::New(); - ListSampleType::Pointer ls = ListSampleType::New(); + ListSampleType::Pointer ls = ListSampleType::New(); reader->SetFileName(argv[1]); reader->Update(); - itk::ImageRegionConstIterator<VectorImageType> it(reader->GetOutput(),reader->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionConstIterator<VectorImageType> it(reader->GetOutput(), reader->GetOutput()->GetLargestPossibleRegion()); - for(it.GoToBegin();!it.IsAtEnd();++it) + for (it.GoToBegin(); !it.IsAtEnd(); ++it) { ls->PushBack(it.Get()); } - float mscale = atof(argv[4]); + float mscale = atof(argv[4]); unsigned int nbBins = atoi(argv[3]); generator->SetListSample(ls); @@ -56,16 +56,16 @@ int otbListSampleToHistogramListGenerator(int argc, char * argv[]) std::ofstream ofs; ofs.open(argv[2]); - for(unsigned int comp = 0; comp<reader->GetOutput()->GetNumberOfComponentsPerPixel();++comp) + for (unsigned int comp = 0; comp < reader->GetOutput()->GetNumberOfComponentsPerPixel(); ++comp) { - ofs<<"Channel: "<<comp<<" histogram: "<<std::endl; - for(unsigned int bin = 0; bin <nbBins;++bin) + ofs << "Channel: " << comp << " histogram: " << std::endl; + for (unsigned int bin = 0; bin < nbBins; ++bin) { - ofs<<generator->GetOutput()->GetNthElement(comp)->GetFrequency(bin)<<"\t"; + ofs << generator->GetOutput()->GetNthElement(comp)->GetFrequency(bin) << "\t"; } - ofs<<std::endl; + ofs << std::endl; } - + ofs.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/BasicFilters/otbListSampleToHistogramListGeneratorNew.cxx b/Testing/Code/BasicFilters/otbListSampleToHistogramListGeneratorNew.cxx index 3a15888861..cc0b3b640a 100644 --- a/Testing/Code/BasicFilters/otbListSampleToHistogramListGeneratorNew.cxx +++ b/Testing/Code/BasicFilters/otbListSampleToHistogramListGeneratorNew.cxx @@ -21,13 +21,13 @@ int otbListSampleToHistogramListGeneratorNew(int argc, char * argv[]) { - + typedef double PixelType; typedef otb::VectorImage<PixelType> VectorImageType; typedef VectorImageType::PixelType VectorPixelType; typedef itk::Statistics::ListSample<VectorPixelType> ListSampleType; typedef otb::ListSampleToHistogramListGenerator - <ListSampleType,PixelType> HistogramGeneratorType; + <ListSampleType, PixelType> HistogramGeneratorType; // Instantiation HistogramGeneratorType::Pointer generator = HistogramGeneratorType::New(); diff --git a/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.cxx b/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.cxx index 26b307053e..212a926574 100644 --- a/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.cxx +++ b/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.cxx @@ -28,20 +28,20 @@ int otbListSampleToVariableDimensionHistogramGenerator(int argc, char * argv[]) typedef VectorImageType::PixelType VectorPixelType; typedef itk::Statistics::ListSample<VectorPixelType> ListSampleType; typedef otb::ListSampleToVariableDimensionHistogramGenerator - <ListSampleType,PixelType> HistogramGeneratorType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; + <ListSampleType, PixelType> HistogramGeneratorType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; // Instantiation ReaderType::Pointer reader = ReaderType::New(); HistogramGeneratorType::Pointer generator = HistogramGeneratorType::New(); - ListSampleType::Pointer ls = ListSampleType::New(); + ListSampleType::Pointer ls = ListSampleType::New(); reader->SetFileName(argv[1]); reader->Update(); - itk::ImageRegionConstIterator<VectorImageType> it(reader->GetOutput(),reader->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionConstIterator<VectorImageType> it(reader->GetOutput(), reader->GetOutput()->GetLargestPossibleRegion()); - for(it.GoToBegin();!it.IsAtEnd();++it) + for (it.GoToBegin(); !it.IsAtEnd(); ++it) { ls->PushBack(it.Get()); } @@ -58,16 +58,16 @@ int otbListSampleToVariableDimensionHistogramGenerator(int argc, char * argv[]) std::ofstream ofs; ofs.open(argv[2]); - for(unsigned int comp = 0; comp<reader->GetOutput()->GetNumberOfComponentsPerPixel();++comp) + for (unsigned int comp = 0; comp < reader->GetOutput()->GetNumberOfComponentsPerPixel(); ++comp) { - ofs<<"Channel: "<<comp<<" histogram: "<<std::endl; - for(unsigned int bin = 0; bin < static_cast<unsigned int>(nbBins[comp]);++bin) + ofs << "Channel: " << comp << " histogram: " << std::endl; + for (unsigned int bin = 0; bin < static_cast<unsigned int>(nbBins[comp]); ++bin) { - ofs<<generator->GetOutput()->GetFrequency(bin,comp)<<"\t"; + ofs << generator->GetOutput()->GetFrequency(bin, comp) << "\t"; } - ofs<<std::endl; + ofs << std::endl; } - + ofs.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGeneratorNew.cxx b/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGeneratorNew.cxx index 624c4a2d9d..4b1b412cf4 100644 --- a/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGeneratorNew.cxx +++ b/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGeneratorNew.cxx @@ -21,13 +21,13 @@ int otbListSampleToVariableDimensionHistogramGeneratorNew(int argc, char * argv[]) { - + typedef double PixelType; typedef otb::VectorImage<PixelType> VectorImageType; typedef VectorImageType::PixelType VectorPixelType; typedef itk::Statistics::ListSample<VectorPixelType> ListSampleType; typedef otb::ListSampleToVariableDimensionHistogramGenerator - <ListSampleType,PixelType> HistogramGeneratorType; + <ListSampleType, PixelType> HistogramGeneratorType; // Instantiation HistogramGeneratorType::Pointer generator = HistogramGeneratorType::New(); diff --git a/Testing/Code/BasicFilters/otbLogPolarTransform.cxx b/Testing/Code/BasicFilters/otbLogPolarTransform.cxx index 7cc985a60d..28d08f823a 100644 --- a/Testing/Code/BasicFilters/otbLogPolarTransform.cxx +++ b/Testing/Code/BasicFilters/otbLogPolarTransform.cxx @@ -24,59 +24,58 @@ int otbLogPolarTransform(int argc, char* argv[]) { - double radialStep = atof(argv[1]); - double angularStep = atof(argv[2]); + double radialStep = atof(argv[1]); + double angularStep = atof(argv[2]); const char * outputFilename(argv[3]); unsigned int nbPoints = atoi(argv[4]); - typedef double PrecisionType; + typedef double PrecisionType; typedef otb::LogPolarTransform<PrecisionType> LogPolarTransformType; - typedef itk::Point<PrecisionType,2> PointType; - typedef std::vector<PointType> PointsVectorType; - + typedef itk::Point<PrecisionType, 2> PointType; + typedef std::vector<PointType> PointsVectorType; std::ofstream file; file.open(outputFilename); - file << "input points retrieval : "<<std::endl; + file << "input points retrieval : " << std::endl; // input points retrieval PointsVectorType vect; - for (unsigned int i=0;i<nbPoints;++i) - { + for (unsigned int i = 0; i < nbPoints; ++i) + { PointType p; - p[0]=atof(argv[5+2*i]); - p[1]=atof(argv[6+2*i]); - file<<"Adding point "<<p<<"."<<std::endl; + p[0] = atof(argv[5 + 2 * i]); + p[1] = atof(argv[6 + 2 * i]); + file << "Adding point " << p << "." << std::endl; vect.push_back(p); - } + } // Instantiation - LogPolarTransformType::Pointer transform = LogPolarTransformType::New(); + LogPolarTransformType::Pointer transform = LogPolarTransformType::New(); LogPolarTransformType::ParametersType params(4); - params[0]=0.; - params[1]=0.; - params[2]=radialStep; - params[3]=angularStep; + params[0] = 0.; + params[1] = 0.; + params[2] = radialStep; + params[3] = angularStep; transform->SetParameters(params); - file << "Transform calculation ... :" <<std::endl; - for (PointsVectorType::iterator it=vect.begin();it!=vect.end();++it) - { + file << "Transform calculation ... :" << std::endl; + for (PointsVectorType::iterator it = vect.begin(); it != vect.end(); ++it) + { PointType p = transform->TransformPoint(*it); PointType pprime; - double theta = (*it)[0]*angularStep* otb::CONST_PI/180.0; - double logRho = (*it)[1]*radialStep; + double theta = (*it)[0] * angularStep * otb::CONST_PI / 180.0; + double logRho = (*it)[1] * radialStep; - file <<"Rho: "<<logRho<<", Theta: "<<theta<<std::endl; - pprime[0]=vcl_exp(logRho) * vcl_cos(theta); - pprime[1]=vcl_exp(logRho) * vcl_sin(theta); + file << "Rho: " << logRho << ", Theta: " << theta << std::endl; + pprime[0] = vcl_exp(logRho) * vcl_cos(theta); + pprime[1] = vcl_exp(logRho) * vcl_sin(theta); - file <<"Original Point: "<<(*it)<<", Reference point: "<<pprime<<", Transformed point: "<<p<<std::endl<<std::endl; - } + file << "Original Point: " << (*it) << ", Reference point: " << pprime << ", Transformed point: " << p << + std::endl << std::endl; + } file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbLogPolarTransformNew.cxx b/Testing/Code/BasicFilters/otbLogPolarTransformNew.cxx index e21e0d9ebf..df860547a8 100644 --- a/Testing/Code/BasicFilters/otbLogPolarTransformNew.cxx +++ b/Testing/Code/BasicFilters/otbLogPolarTransformNew.cxx @@ -20,12 +20,11 @@ int otbLogPolarTransformNew(int argc, char* argv[]) { - typedef double PrecisionType; + typedef double PrecisionType; typedef otb::LogPolarTransform<PrecisionType> LogPolarTransformType; // Instantiation LogPolarTransformType::Pointer transform = LogPolarTransformType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbLogPolarTransformResample.cxx b/Testing/Code/BasicFilters/otbLogPolarTransformResample.cxx index 0290e035d9..a2621dccdf 100644 --- a/Testing/Code/BasicFilters/otbLogPolarTransformResample.cxx +++ b/Testing/Code/BasicFilters/otbLogPolarTransformResample.cxx @@ -30,15 +30,14 @@ int otbLogPolarTransformResample(int argc, char* argv[]) char * outputFileName = argv[2]; const unsigned int Dimension = 2; - typedef double PrecisionType; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::LogPolarTransform<PrecisionType> LogPolarTransformType; - typedef itk::LinearInterpolateImageFunction<ImageType,PrecisionType> InterpolatorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::ResampleImageFilter<ImageType,ImageType,PrecisionType> ResampleFilterType; - + typedef double PrecisionType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::LogPolarTransform<PrecisionType> LogPolarTransformType; + typedef itk::LinearInterpolateImageFunction<ImageType, PrecisionType> InterpolatorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::ResampleImageFilter<ImageType, ImageType, PrecisionType> ResampleFilterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); @@ -47,21 +46,23 @@ int otbLogPolarTransformResample(int argc, char* argv[]) InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetInputImage(reader->GetOutput()); - std::cout<<interpolator<<std::endl; + std::cout << interpolator << std::endl; LogPolarTransformType::Pointer transform = LogPolarTransformType::New(); LogPolarTransformType::ParametersType params(4); // Center the transform - params[0]=0.5*static_cast<double>(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]); - params[1]=0.5*static_cast<double>(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]); - params[2]=360./1024; - params[3]=vcl_log(vcl_sqrt(vcl_pow(static_cast<double>(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]),2) - +vcl_pow(static_cast<double>(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]),2))/2)/512; + params[0] = 0.5 * static_cast<double>(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]); + params[1] = 0.5 * static_cast<double>(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]); + params[2] = 360. / 1024; + params[3] = + vcl_log(vcl_sqrt(vcl_pow(static_cast<double>(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]), 2) + + vcl_pow(static_cast<double>(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[ + 1]), 2)) / 2) / 512; transform->SetParameters(params); ImageType::SizeType size; - size[0]=1024; - size[1]=512; + size[0] = 1024; + size[1] = 512; ResampleFilterType::Pointer resampler = ResampleFilterType::New(); resampler->SetInput(reader->GetOutput()); @@ -75,6 +76,5 @@ int otbLogPolarTransformResample(int argc, char* argv[]) writer->SetInput(resampler->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilter.cxx b/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilter.cxx index b55e627073..4699f3b1aa 100644 --- a/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilter.cxx @@ -16,15 +16,13 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImage.h" #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbStreamingMatrixTransposeMatrixImageFilter.h" - -int otbMatrixTransposeMatrixImageFilter( int argc, char * argv[] ) +int otbMatrixTransposeMatrixImageFilter(int argc, char * argv[]) { const char * infname1 = argv[1]; const char * infname2 = argv[2]; @@ -36,16 +34,17 @@ int otbMatrixTransposeMatrixImageFilter( int argc, char * argv[] ) typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::VectorImage<InputPixelType,Dimension> InputImage1Type; - typedef otb::VectorImage<InputPixelType,Dimension> InputImage2Type; - typedef otb::StreamingMatrixTransposeMatrixImageFilter<InputImage1Type, InputImage2Type > MatrixTransposeMatrixImageFilterType; - typedef otb::ImageFileReader<InputImage1Type> ReaderType1; - typedef otb::ImageFileReader<InputImage2Type> ReaderType2; + typedef otb::VectorImage<InputPixelType, Dimension> InputImage1Type; + typedef otb::VectorImage<InputPixelType, Dimension> InputImage2Type; + typedef otb::StreamingMatrixTransposeMatrixImageFilter<InputImage1Type, + InputImage2Type> MatrixTransposeMatrixImageFilterType; + typedef otb::ImageFileReader<InputImage1Type> ReaderType1; + typedef otb::ImageFileReader<InputImage2Type> ReaderType2; // Instantiation MatrixTransposeMatrixImageFilterType::Pointer filter = MatrixTransposeMatrixImageFilterType::New(); - ReaderType1::Pointer reader1 = ReaderType1::New(); - ReaderType2::Pointer reader2 = ReaderType2::New(); + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); reader1->SetFileName(infname1); reader2->SetFileName(infname2); @@ -61,11 +60,8 @@ int otbMatrixTransposeMatrixImageFilter( int argc, char * argv[] ) std::ofstream file; file.open(outfname); - file<<"transpose : "<<filter->GetResult()<<std::endl; + file << "transpose : " << filter->GetResult() << std::endl; file.close(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilterNew.cxx b/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilterNew.cxx index 55a4ad6041..6d4f39bc67 100644 --- a/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilterNew.cxx @@ -16,28 +16,24 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImage.h" #include "otbVectorImage.h" #include "otbStreamingMatrixTransposeMatrixImageFilter.h" - -int otbMatrixTransposeMatrixImageFilterNew( int argc, char * argv[] ) +int otbMatrixTransposeMatrixImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::VectorImage<InputPixelType,Dimension> InputImage1Type; - typedef otb::VectorImage<InputPixelType,Dimension> InputImage2Type; - typedef otb::StreamingMatrixTransposeMatrixImageFilter<InputImage1Type, InputImage2Type > MatrixTransposeMatrixImageFilterType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImage1Type; + typedef otb::VectorImage<InputPixelType, Dimension> InputImage2Type; + typedef otb::StreamingMatrixTransposeMatrixImageFilter<InputImage1Type, + InputImage2Type> MatrixTransposeMatrixImageFilterType; // Instantiation MatrixTransposeMatrixImageFilterType::Pointer filter = MatrixTransposeMatrixImageFilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbMeanFunctorImageTest.cxx b/Testing/Code/BasicFilters/otbMeanFunctorImageTest.cxx index 4bed62290b..4939ebfdea 100644 --- a/Testing/Code/BasicFilters/otbMeanFunctorImageTest.cxx +++ b/Testing/Code/BasicFilters/otbMeanFunctorImageTest.cxx @@ -30,13 +30,13 @@ int otbMeanFunctorImageTest(int argc, char * argv[]) const char * outfname = argv[2]; const unsigned int Dimension = 2; - typedef unsigned char PixelType; + typedef unsigned char PixelType; typedef otb::VectorImage<PixelType, Dimension> VectorImageType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::Functor::MeanFunctor<VectorImageType::PixelType, ImageType::PixelType > + typedef otb::Functor::MeanFunctor<VectorImageType::PixelType, ImageType::PixelType> MeanFunctorType; typedef itk::UnaryFunctorImageFilter<VectorImageType, ImageType, MeanFunctorType> MeanFilterType; diff --git a/Testing/Code/BasicFilters/otbMeanShiftImageFilter.cxx b/Testing/Code/BasicFilters/otbMeanShiftImageFilter.cxx index be28857762..d8dd669932 100644 --- a/Testing/Code/BasicFilters/otbMeanShiftImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbMeanShiftImageFilter.cxx @@ -25,10 +25,12 @@ int otbMeanShiftImageFilter(int argc, char * argv[]) { if (argc != 12) - { - std::cerr<<"Usage: "<<argv[0]<<" infname filteredfname clusteredfname labeledclusteredfname clusterboundariesfname spatialRadius rangeRadius minregionsize scale streamed threaded"<<std::endl; + { + std::cerr << "Usage: " << argv[0] << + " infname filteredfname clusteredfname labeledclusteredfname clusterboundariesfname spatialRadius rangeRadius minregionsize scale streamed threaded" + << std::endl; return EXIT_FAILURE; - } + } const char * infname = argv[1]; const char * filteredfname = argv[2]; @@ -43,12 +45,12 @@ int otbMeanShiftImageFilter(int argc, char * argv[]) bool threaded = atoi(argv[11]); const unsigned int Dimension = 2; - typedef float PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; + typedef float PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingImageFileWriter<ImageType> StreamingWriterType; typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::MeanShiftImageFilter<ImageType,ImageType> FilterType; + typedef otb::MeanShiftImageFilter<ImageType, ImageType> FilterType; typedef FilterType::LabeledOutputType LabeledImageType; typedef otb::StreamingImageFileWriter<LabeledImageType> LabeledStreamingWriterType; typedef otb::ImageFileWriter<LabeledImageType> LabeledWriterType; @@ -57,27 +59,25 @@ int otbMeanShiftImageFilter(int argc, char * argv[]) FilterType::Pointer filter = FilterType::New(); ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(infname); - filter->SetSpatialRadius(spatialRadius); filter->SetRangeRadius(rangeRadius); filter->SetMinimumRegionSize(minRegionSize); filter->SetScale(scale); if (!threaded) - { + { filter->SetNumberOfThreads(1); - } + } filter->SetInput(reader->GetOutput()); if (streamed) - { + { - StreamingWriterType::Pointer writer1 = StreamingWriterType::New(); - StreamingWriterType::Pointer writer2 = StreamingWriterType::New(); + StreamingWriterType::Pointer writer1 = StreamingWriterType::New(); + StreamingWriterType::Pointer writer2 = StreamingWriterType::New(); LabeledStreamingWriterType::Pointer writer3 = LabeledStreamingWriterType::New(); LabeledStreamingWriterType::Pointer writer4 = LabeledStreamingWriterType::New(); writer1->SetFileName(filteredfname); @@ -93,13 +93,13 @@ int otbMeanShiftImageFilter(int argc, char * argv[]) writer3->Update(); writer4->Update(); - } + } else - { + { - WriterType::Pointer writer1 = WriterType::New(); - WriterType::Pointer writer2 = WriterType::New(); + WriterType::Pointer writer1 = WriterType::New(); + WriterType::Pointer writer2 = WriterType::New(); LabeledWriterType::Pointer writer3 = LabeledWriterType::New(); LabeledWriterType::Pointer writer4 = LabeledWriterType::New(); writer1->SetFileName(filteredfname); @@ -115,7 +115,7 @@ int otbMeanShiftImageFilter(int argc, char * argv[]) writer3->Update(); writer4->Update(); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew.cxx b/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew.cxx index fc68de6a1a..1747883334 100644 --- a/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew.cxx @@ -22,9 +22,9 @@ int otbMeanShiftImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef short PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::MeanShiftImageFilter<ImageType,ImageType> FilterType; + typedef short PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::MeanShiftImageFilter<ImageType, ImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilter.cxx b/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilter.cxx index ed0652f1b6..98563dc3f1 100644 --- a/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilter.cxx @@ -25,10 +25,12 @@ int otbMeanShiftVectorImageFilter(int argc, char * argv[]) { if (argc != 12) - { - std::cerr<<"Usage: "<<argv[0]<<" infname filteredfname clusteredfname labeledclusteredfname clusterboundariesfname spatialRadius rangeRadius minregionsize scale streamed threaded"<<std::endl; + { + std::cerr << "Usage: " << argv[0] << + " infname filteredfname clusteredfname labeledclusteredfname clusterboundariesfname spatialRadius rangeRadius minregionsize scale streamed threaded" + << std::endl; return EXIT_FAILURE; - } + } const char * infname = argv[1]; const char * filteredfname = argv[2]; @@ -43,12 +45,12 @@ int otbMeanShiftVectorImageFilter(int argc, char * argv[]) bool threaded = atoi(argv[11]); const unsigned int Dimension = 2; - typedef float PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; + typedef float PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingImageFileWriter<ImageType> StreamingWriterType; typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::MeanShiftVectorImageFilter<ImageType,ImageType> FilterType; + typedef otb::MeanShiftVectorImageFilter<ImageType, ImageType> FilterType; typedef FilterType::LabeledOutputType LabeledImageType; typedef otb::StreamingImageFileWriter<LabeledImageType> LabeledStreamingWriterType; typedef otb::ImageFileWriter<LabeledImageType> LabeledWriterType; @@ -57,27 +59,25 @@ int otbMeanShiftVectorImageFilter(int argc, char * argv[]) FilterType::Pointer filter = FilterType::New(); ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(infname); - filter->SetSpatialRadius(spatialRadius); filter->SetRangeRadius(rangeRadius); filter->SetMinimumRegionSize(minRegionSize); filter->SetScale(scale); if (!threaded) - { + { filter->SetNumberOfThreads(1); - } + } filter->SetInput(reader->GetOutput()); if (streamed) - { + { - StreamingWriterType::Pointer writer1 = StreamingWriterType::New(); - StreamingWriterType::Pointer writer2 = StreamingWriterType::New(); + StreamingWriterType::Pointer writer1 = StreamingWriterType::New(); + StreamingWriterType::Pointer writer2 = StreamingWriterType::New(); LabeledStreamingWriterType::Pointer writer3 = LabeledStreamingWriterType::New(); LabeledStreamingWriterType::Pointer writer4 = LabeledStreamingWriterType::New(); writer1->SetFileName(filteredfname); @@ -93,13 +93,13 @@ int otbMeanShiftVectorImageFilter(int argc, char * argv[]) writer3->Update(); writer4->Update(); - } + } else - { + { - WriterType::Pointer writer1 = WriterType::New(); - WriterType::Pointer writer2 = WriterType::New(); + WriterType::Pointer writer1 = WriterType::New(); + WriterType::Pointer writer2 = WriterType::New(); LabeledWriterType::Pointer writer3 = LabeledWriterType::New(); LabeledWriterType::Pointer writer4 = LabeledWriterType::New(); writer1->SetFileName(filteredfname); @@ -115,7 +115,7 @@ int otbMeanShiftVectorImageFilter(int argc, char * argv[]) writer3->Update(); writer4->Update(); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilterNew.cxx b/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilterNew.cxx index da0d673c3b..36ff22bae4 100644 --- a/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilterNew.cxx @@ -23,9 +23,9 @@ int otbMeanShiftVectorImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef short PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::MeanShiftVectorImageFilter<ImageType,ImageType> FilterType; + typedef short PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::MeanShiftVectorImageFilter<ImageType, ImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilter.cxx b/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilter.cxx index c4a387aa8f..f64cad4750 100644 --- a/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilter.cxx @@ -20,23 +20,23 @@ #include "otbStreamingImageFileWriter.h" #include "otbVectorImage.h" -int otbNormalizeInnerProductPCAImageFilter( int argc, char* argv[] ) +int otbNormalizeInnerProductPCAImageFilter(int argc, char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; - const char * inputFileName = argv[1]; - const char * outputFilename = argv[2]; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::StreamingImageFileWriter< ImageType > WriterType; - typedef otb::NormalizeInnerProductPCAImageFilter<ImageType,ImageType> NormalizePCAFilterType; - - ReaderType::Pointer reader = ReaderType::New(); + const char * inputFileName = argv[1]; + const char * outputFilename = argv[2]; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::NormalizeInnerProductPCAImageFilter<ImageType, ImageType> NormalizePCAFilterType; + + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFilename); - NormalizePCAFilterType::Pointer normalizepcafilter = NormalizePCAFilterType::New(); + NormalizePCAFilterType::Pointer normalizepcafilter = NormalizePCAFilterType::New(); normalizepcafilter->SetInput(reader->GetOutput()); writer->SetInput(normalizepcafilter->GetOutput()); diff --git a/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilterNew.cxx b/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilterNew.cxx index a48559e4e1..367f265f9c 100644 --- a/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilterNew.cxx @@ -18,14 +18,14 @@ #include "otbNormalizeInnerProductPCAImageFilter.h" #include "otbVectorImage.h" -int otbNormalizeInnerProductPCAImageFilterNew( int argc, char* argv[] ) +int otbNormalizeInnerProductPCAImageFilterNew(int argc, char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; // Typedef - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::NormalizeInnerProductPCAImageFilter<ImageType,ImageType> FilterType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::NormalizeInnerProductPCAImageFilter<ImageType, ImageType> FilterType; // Instantiation object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilter.cxx b/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilter.cxx index b206888482..1016734d37 100644 --- a/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilter.cxx +++ b/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilter.cxx @@ -34,15 +34,15 @@ int otbOpeningClosingMorphologicalFilter(int argc, char * argv[]) typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::OpeningClosingMorphologicalFilter<InputImageType,OutputImageType, - StructuringElementType> OpeningClosingFilterType; + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::OpeningClosingMorphologicalFilter<InputImageType, OutputImageType, + StructuringElementType> OpeningClosingFilterType; // Reading input image ReaderType::Pointer reader = ReaderType::New(); @@ -64,6 +64,5 @@ int otbOpeningClosingMorphologicalFilter(int argc, char * argv[]) writer->SetInput(openingClosing->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilterNew.cxx b/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilterNew.cxx index ac5d8f25a3..8ea7c7f853 100644 --- a/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilterNew.cxx @@ -24,17 +24,16 @@ int otbOpeningClosingMorphologicalFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::OpeningClosingMorphologicalFilter<InputImageType,OutputImageType, - StructuringElementType> OpeningClosingFilterType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::OpeningClosingMorphologicalFilter<InputImageType, OutputImageType, + StructuringElementType> OpeningClosingFilterType; // instantiating the opening closing filter OpeningClosingFilterType::Pointer openingClosing = OpeningClosingFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.cxx b/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.cxx index 85a5215421..62e96fb034 100644 --- a/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.cxx @@ -24,21 +24,20 @@ #include "otbImageFileWriter.h" #include "otbOverlapSaveConvolutionImageFilter.h" - -int otbOverlapSaveConvolutionImageFilter( int argc, char * argv[] ) +int otbOverlapSaveConvolutionImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > PanchroImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< PanchroImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef otb::OverlapSaveConvolutionImageFilter< PanchroImageType,OutputImageType > ConvFilterType; + typedef otb::Image<InputPixelType, Dimension> PanchroImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<PanchroImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::OverlapSaveConvolutionImageFilter<PanchroImageType, OutputImageType> ConvFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -48,18 +47,18 @@ int otbOverlapSaveConvolutionImageFilter( int argc, char * argv[] ) writer->SetFileName(outputFileName); ConvFilterType::InputSizeType radius; - radius[0]=3; - radius[1]=3; + radius[0] = 3; + radius[1] = 3; ConvFilterType::ArrayType filterCoeffs; - filterCoeffs.SetSize((2*radius[0]+1)*(2*radius[1]+1)); + filterCoeffs.SetSize((2 * radius[0] + 1) * (2 * radius[1] + 1)); filterCoeffs.Fill(1); convFilter->SetRadius(radius); convFilter->SetFilter(filterCoeffs); convFilter->NormalizeFilterOn(); - convFilter->SetInput( reader->GetOutput() ); - writer->SetInput( convFilter->GetOutput() ); + convFilter->SetInput(reader->GetOutput()); + writer->SetInput(convFilter->GetOutput()); writer->Update(); diff --git a/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilterNew.cxx b/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilterNew.cxx index 9604614a77..0761a5cc61 100644 --- a/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilterNew.cxx @@ -22,19 +22,17 @@ #include "otbImage.h" #include "otbOverlapSaveConvolutionImageFilter.h" - -int otbOverlapSaveConvolutionImageFilterNew( int argc, char * argv[] ) +int otbOverlapSaveConvolutionImageFilterNew(int argc, char * argv[]) { - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::OverlapSaveConvolutionImageFilter< InputImageType,OutputImageType > FilterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::OverlapSaveConvolutionImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer conv = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbPathLengthFunctor.cxx b/Testing/Code/BasicFilters/otbPathLengthFunctor.cxx index 7a9f186736..e1f95af003 100644 --- a/Testing/Code/BasicFilters/otbPathLengthFunctor.cxx +++ b/Testing/Code/BasicFilters/otbPathLengthFunctor.cxx @@ -32,28 +32,28 @@ #include "otbPathLengthFunctor.h" #include "otbUnaryFunctorObjectListBooleanFilter.h" -int otbPathLengthFunctor( int argc, char * argv[] ) +int otbPathLengthFunctor(int argc, char * argv[]) { - if (argc !=3 ) - { + if (argc != 3) + { std::cout << "Usage: " << argv[0]; std::cout << " inputImage outputFile" << std::endl; return 1; - } + } typedef unsigned char InputPixelType; - typedef unsigned short LabelPixelType;//FIXME doesn't seem to work with long int (64 bits problem ?) + typedef unsigned short LabelPixelType; //FIXME doesn't seem to work with long int (64 bits problem ?) - typedef otb::Image<InputPixelType,2> InputImageType; - typedef otb::Image<LabelPixelType,2> LabelImageType; + typedef otb::Image<InputPixelType, 2> InputImageType; + typedef otb::Image<LabelPixelType, 2> LabelImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); - typedef itk::ConnectedComponentImageFilter<InputImageType,LabelImageType> ConnectedComponentsFilterType; - ConnectedComponentsFilterType::Pointer connectedComponentsFilter = ConnectedComponentsFilterType::New(); + typedef itk::ConnectedComponentImageFilter<InputImageType, LabelImageType> ConnectedComponentsFilterType; + ConnectedComponentsFilterType::Pointer connectedComponentsFilter = ConnectedComponentsFilterType::New(); // connectedComponentsFilter->SetInput(reader->GetOutput()); connectedComponentsFilter->SetInput(reader->GetOutput()); @@ -61,14 +61,14 @@ int otbPathLengthFunctor( int argc, char * argv[] ) std::cout << "# regions: " << connectedComponentsFilter->GetObjectCount() << std::endl; - typedef otb::Polygon<double> PolygonType; - typedef otb::ObjectList<PolygonType> PolygonListType; - typedef otb::ImageToEdgePathFilter<LabelImageType,PolygonType> PolygonFilterType; + typedef otb::Polygon<double> PolygonType; + typedef otb::ObjectList<PolygonType> PolygonListType; + typedef otb::ImageToEdgePathFilter<LabelImageType, PolygonType> PolygonFilterType; PolygonListType::Pointer polygonList = PolygonListType::New(); - for (LabelPixelType label = 1; label<=connectedComponentsFilter->GetObjectCount();++label) - { + for (LabelPixelType label = 1; label <= connectedComponentsFilter->GetObjectCount(); ++label) + { std::cerr << "."; PolygonFilterType::Pointer polygonFilter = PolygonFilterType::New(); polygonFilter->SetInput(connectedComponentsFilter->GetOutput()); @@ -76,40 +76,41 @@ int otbPathLengthFunctor( int argc, char * argv[] ) polygonFilter->Update(); polygonList->PushBack(polygonFilter->GetOutput()); - } + } - typedef otb::PathLengthFunctor<PolygonType::Pointer> LengthFunctorType; - typedef otb::UnaryFunctorObjectListBooleanFilter<PolygonListType,PolygonListType,LengthFunctorType> PathLengthFilterType; + typedef otb::PathLengthFunctor<PolygonType::Pointer> + LengthFunctorType; + typedef otb::UnaryFunctorObjectListBooleanFilter<PolygonListType, PolygonListType, + LengthFunctorType> PathLengthFilterType; PathLengthFilterType::Pointer pathLengthFilter = PathLengthFilterType::New(); pathLengthFilter->SetInput(polygonList); pathLengthFilter->GetFunctor().SetThreshold(500); pathLengthFilter->Update(); - const char * outfile = argv[2]; + const char * outfile = argv[2]; std::ofstream file; file.open(outfile); - typedef PolygonType::VertexListType VertexListType; + typedef PolygonType::VertexListType VertexListType; typedef VertexListType::ConstIterator IteratorType; typedef PolygonListType::ConstIterator PolygonListIteratorType; for (PolygonListIteratorType pIt = pathLengthFilter->GetOutput()->Begin(); - pIt!=pathLengthFilter->GetOutput()->End(); + pIt != pathLengthFilter->GetOutput()->End(); ++pIt) - { - file<< "--- New Polygon ---" << std::endl; - PolygonType::Pointer polygon=pIt.Get(); - IteratorType it; - for (it=polygon->GetVertexList()->Begin();it!=polygon->GetVertexList()->End();++it) { - file<<it.Value()<<std::endl; - + file << "--- New Polygon ---" << std::endl; + PolygonType::Pointer polygon = pIt.Get(); + IteratorType it; + for (it = polygon->GetVertexList()->Begin(); it != polygon->GetVertexList()->End(); ++it) + { + file << it.Value() << std::endl; + + } } - } file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbPerBandVectorImageFilterNew.cxx b/Testing/Code/BasicFilters/otbPerBandVectorImageFilterNew.cxx index 2ef7bf272f..6c770b47d6 100644 --- a/Testing/Code/BasicFilters/otbPerBandVectorImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbPerBandVectorImageFilterNew.cxx @@ -25,17 +25,16 @@ int otbPerBandVectorImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef itk::MeanImageFilter<ImageType,ImageType> MeanFilterType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef itk::MeanImageFilter<ImageType, ImageType> MeanFilterType; - typedef otb::PerBandVectorImageFilter<VectorImageType,VectorImageType,MeanFilterType> + typedef otb::PerBandVectorImageFilter<VectorImageType, VectorImageType, MeanFilterType> PerBandVectorImageFilterType; // Instantiating object PerBandVectorImageFilterType::Pointer object = PerBandVectorImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithMeanFilter.cxx b/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithMeanFilter.cxx index d288cd0402..f97e3f357b 100644 --- a/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithMeanFilter.cxx +++ b/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithMeanFilter.cxx @@ -30,12 +30,12 @@ int otbPerBandVectorImageFilterWithMeanFilter(int argc, char * argv[]) const char * outfname = argv[2]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef itk::MeanImageFilter<ImageType,ImageType> MeanFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef itk::MeanImageFilter<ImageType, ImageType> MeanFilterType; - typedef otb::PerBandVectorImageFilter<VectorImageType,VectorImageType,MeanFilterType> + typedef otb::PerBandVectorImageFilter<VectorImageType, VectorImageType, MeanFilterType> PerBandVectorImageFilterType; typedef otb::ImageFileReader<VectorImageType> ReaderType; @@ -55,6 +55,5 @@ int otbPerBandVectorImageFilterWithMeanFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithSobelFilter.cxx b/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithSobelFilter.cxx index ae00ef046f..c48c25a611 100644 --- a/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithSobelFilter.cxx +++ b/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithSobelFilter.cxx @@ -30,12 +30,12 @@ int otbPerBandVectorImageFilterWithSobelFilter(int argc, char * argv[]) const char * outfname = argv[2]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef itk::SobelEdgeDetectionImageFilter<ImageType,ImageType> SobelFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef itk::SobelEdgeDetectionImageFilter<ImageType, ImageType> SobelFilterType; - typedef otb::PerBandVectorImageFilter<VectorImageType,VectorImageType,SobelFilterType> + typedef otb::PerBandVectorImageFilter<VectorImageType, VectorImageType, SobelFilterType> PerBandVectorImageFilterType; typedef otb::ImageFileReader<VectorImageType> ReaderType; @@ -55,6 +55,5 @@ int otbPerBandVectorImageFilterWithSobelFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbPersistentVectorizationFilter.cxx b/Testing/Code/BasicFilters/otbPersistentVectorizationFilter.cxx index 310ea2dcca..89b8b3ced5 100644 --- a/Testing/Code/BasicFilters/otbPersistentVectorizationFilter.cxx +++ b/Testing/Code/BasicFilters/otbPersistentVectorizationFilter.cxx @@ -31,10 +31,10 @@ int otbPersistentVectorizationFilter(int argc, char * argv[]) const unsigned int ImageDimension = 2; typedef unsigned short LabelType; - typedef otb::Image<LabelType, ImageDimension> ImageType; - typedef otb::Polygon <LabelType> PolygonType; - typedef otb::PersistentVectorizationImageFilter<ImageType,PolygonType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<LabelType, ImageDimension> ImageType; + typedef otb::Polygon <LabelType> PolygonType; + typedef otb::PersistentVectorizationImageFilter<ImageType, PolygonType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -51,15 +51,15 @@ int otbPersistentVectorizationFilter(int argc, char * argv[]) for (PathListType::Iterator it = filter->GetPathList()->Begin(); it != filter->GetPathList()->End(); ++it) - { - for (unsigned int i = 0; i < it.Get()->GetVertexList()->Size();++i) { - f<<"[ "<<it.Get()->GetVertexList()->GetElement(i)[0] - <<", "<<it.Get()->GetVertexList()->GetElement(i)[1] - <<"] "; + for (unsigned int i = 0; i < it.Get()->GetVertexList()->Size(); ++i) + { + f << "[ " << it.Get()->GetVertexList()->GetElement(i)[0] + << ", " << it.Get()->GetVertexList()->GetElement(i)[1] + << "] "; + } + f << std::endl; } - f<<std::endl; - } f.close(); diff --git a/Testing/Code/BasicFilters/otbPersistentVectorizationFilterNew.cxx b/Testing/Code/BasicFilters/otbPersistentVectorizationFilterNew.cxx index 13704c1334..387669e816 100644 --- a/Testing/Code/BasicFilters/otbPersistentVectorizationFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbPersistentVectorizationFilterNew.cxx @@ -26,9 +26,9 @@ int otbPersistentVectorizationFilterNew(int argc, char * argv[]) const unsigned int ImageDimension = 2; typedef unsigned short LabelType; - typedef otb::Image<LabelType, ImageDimension> ImageType; - typedef otb::Polygon <LabelType> PolygonType; - typedef otb::PersistentVectorizationImageFilter<ImageType,PolygonType> FilterType; + typedef otb::Image<LabelType, ImageDimension> ImageType; + typedef otb::Polygon <LabelType> PolygonType; + typedef otb::PersistentVectorizationImageFilter<ImageType, PolygonType> FilterType; FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbPointSetDensityFunctionNew.cxx b/Testing/Code/BasicFilters/otbPointSetDensityFunctionNew.cxx index afa0ead808..804a76dc1f 100644 --- a/Testing/Code/BasicFilters/otbPointSetDensityFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbPointSetDensityFunctionNew.cxx @@ -22,20 +22,18 @@ #include "itkPointSet.h" #include "itkVariableLengthVector.h" - -int otbPointSetDensityFunctionNew(int, char* [] ) +int otbPointSetDensityFunctionNew(int, char*[]) { - const unsigned int Dimension = 2; - typedef float PixelType; + const unsigned int Dimension = 2; + typedef float PixelType; - typedef itk::VariableLengthVector<PixelType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::PointSetDensityFunction <PointSetType,PixelType> FunctionType; + typedef itk::VariableLengthVector<PixelType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::PointSetDensityFunction <PointSetType, PixelType> FunctionType; /**Instantiation of a Smart Pointer*/ - FunctionType::Pointer filter = FunctionType::New(); + FunctionType::Pointer filter = FunctionType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx b/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx index d77634a6c4..47d8341c98 100644 --- a/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx +++ b/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx @@ -24,40 +24,38 @@ #include <iostream> -int otbPointSetDensityFunctionTest(int argc, char* argv[] ) +int otbPointSetDensityFunctionTest(int argc, char* argv[]) { const char * outfname = argv[1]; - const unsigned int Dimension = 2; - typedef float PixelType; - - typedef itk::VariableLengthVector<PixelType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::PointSetDensityFunction <PointSetType,PixelType> FunctionType; + const unsigned int Dimension = 2; + typedef float PixelType; + typedef itk::VariableLengthVector<PixelType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::PointSetDensityFunction <PointSetType, PixelType> FunctionType; /**Instantiation of a Smart Pointer*/ PointSetType::Pointer pointSet = PointSetType::New(); - FunctionType::Pointer filter = FunctionType::New(); - std::ofstream outfile(outfname); + FunctionType::Pointer filter = FunctionType::New(); + std::ofstream outfile(outfname); /** Construction of the pointSet */ PointSetType::PointIdentifier count = 0; - PointSetType::PointType pDst ,pSrc; + PointSetType::PointType pDst, pSrc; pDst[0] = 12.78; pDst[1] = 18.76; - pointSet->SetPoint(count++,pDst); + pointSet->SetPoint(count++, pDst); pDst[0] = 15.78; pDst[1] = 23.76; - pointSet->SetPoint(count++,pDst); + pointSet->SetPoint(count++, pDst); pDst[0] = 9.78; pDst[1] = 5.76; - pointSet->SetPoint(count++,pDst); - + pointSet->SetPoint(count++, pDst); filter->SetPointSet(pointSet); filter->SetRadius(2); @@ -65,14 +63,13 @@ int otbPointSetDensityFunctionTest(int argc, char* argv[] ) /**Point we search around*/ pDst[0] = 14.9; pDst[1] = 24; - outfile << "Density computed for the point : " << pDst << " is "<< filter->Evaluate(pDst) << std::endl; + outfile << "Density computed for the point : " << pDst << " is " << filter->Evaluate(pDst) << std::endl; pDst[0] = 9; pDst[1] = 5; - outfile << "Density computed for the point : " << pDst << " is "<< filter->Evaluate(pDst) << std::endl; + outfile << "Density computed for the point : " << pDst << " is " << filter->Evaluate(pDst) << std::endl; outfile.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterNew.cxx b/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterNew.cxx index 7eff49f6cb..7e67485695 100644 --- a/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterNew.cxx @@ -22,22 +22,20 @@ #include "itkPointSet.h" #include "itkVariableLengthVector.h" - -int otbPointSetToDensityImageFilterNew(int, char* [] ) +int otbPointSetToDensityImageFilterNew(int, char*[]) { - const unsigned int Dimension = 2; - typedef float PixelType; + const unsigned int Dimension = 2; + typedef float PixelType; - typedef otb::Image<PixelType , Dimension> ImageType; - typedef itk::VariableLengthVector<PixelType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::PointSetToDensityImageFilter <PointSetType,ImageType> FunctionType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::VariableLengthVector<PixelType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::PointSetToDensityImageFilter <PointSetType, ImageType> FunctionType; /**Instantiation of an object*/ - FunctionType::Pointer filter = FunctionType::New(); + FunctionType::Pointer filter = FunctionType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterTest.cxx b/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterTest.cxx index a21e53b745..21642dc750 100644 --- a/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterTest.cxx +++ b/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterTest.cxx @@ -25,43 +25,39 @@ #include "otbImageFileWriter.h" #include "otbImageToSIFTKeyPointSetFilter.h" - -int otbPointSetToDensityImageFilterTest(int argc, char* argv[] ) +int otbPointSetToDensityImageFilterTest(int argc, char* argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; + const char * infname = argv[1]; + const char * outfname = argv[2]; const unsigned int scales = atoi(argv[3]); const unsigned int octaves = atoi(argv[4]); const unsigned int radius = atoi(argv[5]); + const unsigned int Dimension = 2; + typedef float PixelType; - const unsigned int Dimension = 2; - typedef float PixelType; - - typedef otb::Image<PixelType , Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::VariableLengthVector<PixelType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> DetectorType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::VariableLengthVector<PixelType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> DetectorType; - typedef otb::PointSetToDensityImageFilter <PointSetType,ImageType> FunctionType; + typedef otb::PointSetToDensityImageFilter <PointSetType, ImageType> FunctionType; /**Instantiation of an object*/ - FunctionType::Pointer filter = FunctionType::New(); - DetectorType::Pointer detector = DetectorType::New(); - ReaderType::Pointer reader = ReaderType::New(); + FunctionType::Pointer filter = FunctionType::New(); + DetectorType::Pointer detector = DetectorType::New(); + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); reader->GenerateOutputInformation(); - detector->SetInput(reader->GetOutput()); - detector ->SetOctavesNumber(octaves); + detector->SetOctavesNumber(octaves); detector->SetScalesNumber(scales); - /** PointSetImageToDensity ImageFilter*/ filter->SetInput(detector->GetOutput()); filter->SetRadius(radius); @@ -77,4 +73,3 @@ int otbPointSetToDensityImageFilterTest(int argc, char* argv[] ) return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbPolygonCompacityFunctor.cxx b/Testing/Code/BasicFilters/otbPolygonCompacityFunctor.cxx index a792ff73cf..605cddac60 100644 --- a/Testing/Code/BasicFilters/otbPolygonCompacityFunctor.cxx +++ b/Testing/Code/BasicFilters/otbPolygonCompacityFunctor.cxx @@ -32,28 +32,28 @@ #include "otbPolygonCompacityFunctor.h" #include "otbUnaryFunctorObjectListBooleanFilter.h" -int otbPolygonCompacityFunctor( int argc, char * argv[] ) +int otbPolygonCompacityFunctor(int argc, char * argv[]) { - if (argc !=3 ) - { + if (argc != 3) + { std::cout << "Usage: " << argv[0]; std::cout << " inputImage outputFile" << std::endl; return 1; - } + } typedef unsigned char InputPixelType; - typedef unsigned short LabelPixelType;//FIXME doesn't seem to work with long int (64 bits problem ?) + typedef unsigned short LabelPixelType; //FIXME doesn't seem to work with long int (64 bits problem ?) - typedef otb::Image<InputPixelType,2> InputImageType; - typedef otb::Image<LabelPixelType,2> LabelImageType; + typedef otb::Image<InputPixelType, 2> InputImageType; + typedef otb::Image<LabelPixelType, 2> LabelImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); - typedef itk::ConnectedComponentImageFilter<InputImageType,LabelImageType> ConnectedComponentsFilterType; - ConnectedComponentsFilterType::Pointer connectedComponentsFilter = ConnectedComponentsFilterType::New(); + typedef itk::ConnectedComponentImageFilter<InputImageType, LabelImageType> ConnectedComponentsFilterType; + ConnectedComponentsFilterType::Pointer connectedComponentsFilter = ConnectedComponentsFilterType::New(); // connectedComponentsFilter->SetInput(reader->GetOutput()); connectedComponentsFilter->SetInput(reader->GetOutput()); @@ -61,14 +61,14 @@ int otbPolygonCompacityFunctor( int argc, char * argv[] ) std::cout << "# regions: " << connectedComponentsFilter->GetObjectCount() << std::endl; - typedef otb::Polygon<double> PolygonType; - typedef otb::ObjectList<PolygonType> PolygonListType; - typedef otb::ImageToEdgePathFilter<LabelImageType,PolygonType> PolygonFilterType; + typedef otb::Polygon<double> PolygonType; + typedef otb::ObjectList<PolygonType> PolygonListType; + typedef otb::ImageToEdgePathFilter<LabelImageType, PolygonType> PolygonFilterType; PolygonListType::Pointer polygonList = PolygonListType::New(); - for (LabelPixelType label = 1; label<=connectedComponentsFilter->GetObjectCount();++label) - { + for (LabelPixelType label = 1; label <= connectedComponentsFilter->GetObjectCount(); ++label) + { std::cerr << "."; PolygonFilterType::Pointer polygonFilter = PolygonFilterType::New(); polygonFilter->SetInput(connectedComponentsFilter->GetOutput()); @@ -76,39 +76,40 @@ int otbPolygonCompacityFunctor( int argc, char * argv[] ) polygonFilter->Update(); polygonList->PushBack(polygonFilter->GetOutput()); - } + } - typedef otb::PolygonCompacityFunctor<PolygonType::Pointer> CompacityFunctorType; - typedef otb::UnaryFunctorObjectListBooleanFilter<PolygonListType,PolygonListType,CompacityFunctorType> CompacityFilterType; + typedef otb::PolygonCompacityFunctor<PolygonType::Pointer> + CompacityFunctorType; + typedef otb::UnaryFunctorObjectListBooleanFilter<PolygonListType, PolygonListType, + CompacityFunctorType> CompacityFilterType; CompacityFilterType::Pointer compacityFilter = CompacityFilterType::New(); compacityFilter->SetInput(polygonList); compacityFilter->Update(); - const char * outfile = argv[2]; + const char * outfile = argv[2]; std::ofstream file; file.open(outfile); - typedef PolygonType::VertexListType VertexListType; + typedef PolygonType::VertexListType VertexListType; typedef VertexListType::ConstIterator IteratorType; typedef PolygonListType::ConstIterator PolygonListIteratorType; for (PolygonListIteratorType pIt = compacityFilter->GetOutput()->Begin(); - pIt!=compacityFilter->GetOutput()->End(); + pIt != compacityFilter->GetOutput()->End(); ++pIt) - { - file<< "--- New Polygon ---" << std::endl; - PolygonType::Pointer polygon=pIt.Get(); - IteratorType it; - for (it=polygon->GetVertexList()->Begin();it!=polygon->GetVertexList()->End();++it) { - file<<it.Value()<<std::endl; - + file << "--- New Polygon ---" << std::endl; + PolygonType::Pointer polygon = pIt.Get(); + IteratorType it; + for (it = polygon->GetVertexList()->Begin(); it != polygon->GetVertexList()->End(); ++it) + { + file << it.Value() << std::endl; + + } } - } file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx b/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx index fa66d922c3..ce60834380 100644 --- a/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx @@ -27,40 +27,35 @@ #include "otbPrintableImageFilter.h" -int otbPrintableImageFilter( int argc, char * argv[] ) +int otbPrintableImageFilter(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef double InputPixelType; - const unsigned int Dimension = 2; - - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::PrintableImageFilter< InputImageType> FilterType; - typedef FilterType::OutputImageType OutputImageType; - typedef otb::StreamingImageFileWriter< OutputImageType > WriterType; + const unsigned int Dimension = 2; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::PrintableImageFilter<InputImageType> FilterType; + typedef FilterType::OutputImageType OutputImageType; + typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; FilterType::Pointer printableImageFilter = FilterType::New(); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - printableImageFilter->SetInput( reader->GetOutput() ); + printableImageFilter->SetInput(reader->GetOutput()); printableImageFilter->SetChannel(3); printableImageFilter->SetChannel(2); printableImageFilter->SetChannel(1); - writer->SetInput( printableImageFilter->GetOutput() ); + writer->SetInput(printableImageFilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx b/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx index 730c6bf3a2..c9bff5d1a2 100644 --- a/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx @@ -24,18 +24,16 @@ #include "otbPrintableImageFilter.h" -int otbPrintableImageFilterNew( int argc, char * argv[] ) +int otbPrintableImageFilterNew(int argc, char * argv[]) { typedef double InputPixelType; - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef otb::PrintableImageFilter< InputImageType> FilterType; + typedef otb::PrintableImageFilter<InputImageType> FilterType; FilterType::Pointer printableImage = FilterType::New(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/BasicFilters/otbPrintableImageFilterWithMask.cxx b/Testing/Code/BasicFilters/otbPrintableImageFilterWithMask.cxx index 238041dc41..58d5420caf 100644 --- a/Testing/Code/BasicFilters/otbPrintableImageFilterWithMask.cxx +++ b/Testing/Code/BasicFilters/otbPrintableImageFilterWithMask.cxx @@ -25,41 +25,38 @@ #include "otbPrintableImageFilter.h" -int otbPrintableImageFilterWithMask( int argc, char * argv[] ) +int otbPrintableImageFilterWithMask(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * masktFilename = argv[2]; const char * outputFilename = argv[3]; + typedef double InputPixelType; + const unsigned int Dimension = 2; - typedef double InputPixelType; - const unsigned int Dimension = 2; - - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::PrintableImageFilter< InputImageType> FilterType; - typedef FilterType::OutputImageType OutputImageType; - typedef OutputImageType::PixelType OutputPixelType; - typedef FilterType::MaskImageType MaskImageType; - typedef FilterType::MaskPixelType MaskPixelType; - - typedef otb::ImageFileReader< InputImageType > InputReaderType; - typedef otb::ImageFileReader< MaskImageType > MaskReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType > WriterType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::PrintableImageFilter<InputImageType> FilterType; + typedef FilterType::OutputImageType OutputImageType; + typedef OutputImageType::PixelType OutputPixelType; + typedef FilterType::MaskImageType MaskImageType; + typedef FilterType::MaskPixelType MaskPixelType; + typedef otb::ImageFileReader<InputImageType> InputReaderType; + typedef otb::ImageFileReader<MaskImageType> MaskReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; FilterType::Pointer printableImageFilter = FilterType::New(); InputReaderType::Pointer inputReader = InputReaderType::New(); MaskReaderType::Pointer maskReader = MaskReaderType::New(); WriterType::Pointer writer = WriterType::New(); - inputReader->SetFileName( inputFilename ); - maskReader->SetFileName( masktFilename ); + inputReader->SetFileName(inputFilename); + maskReader->SetFileName(masktFilename); maskReader->GenerateOutputInformation(); - writer->SetFileName( outputFilename ); + writer->SetFileName(outputFilename); - printableImageFilter->SetInput( inputReader->GetOutput() ); - printableImageFilter->SetInputMask( maskReader->GetOutput() ); - + printableImageFilter->SetInput(inputReader->GetOutput()); + printableImageFilter->SetInputMask(maskReader->GetOutput()); FilterType::ChannelsType chList; chList.push_back(3); @@ -72,16 +69,12 @@ int otbPrintableImageFilterWithMask( int argc, char * argv[] ) objectColor[0] = 0; objectColor[1] = 255; objectColor[2] = 0; - printableImageFilter->SetObjectColor( objectColor ); + printableImageFilter->SetObjectColor(objectColor); printableImageFilter->SetBackgroundMaskValue(static_cast<MaskPixelType>(atof(argv[4]))); - - writer->SetInput( printableImageFilter->GetOutput() ); + writer->SetInput(printableImageFilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/BasicFilters/otbProlateInterpolateImageFunction.cxx b/Testing/Code/BasicFilters/otbProlateInterpolateImageFunction.cxx index d47607b917..c9cae95ea2 100644 --- a/Testing/Code/BasicFilters/otbProlateInterpolateImageFunction.cxx +++ b/Testing/Code/BasicFilters/otbProlateInterpolateImageFunction.cxx @@ -39,27 +39,27 @@ int otbProlateInterpolateImageFunction(int argc, char * argv[]) const char * itkcosfname = argv[4]; const char * profname = argv[5]; - typedef otb::Image<double,2> ImageType; - typedef otb::ProlateInterpolateImageFunction<ImageType> InterpolatorType; - typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<double, 2> ImageType; + typedef otb::ProlateInterpolateImageFunction<ImageType> InterpolatorType; + typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; + typedef otb::ImageFileReader<ImageType> ReaderType; unsigned int i = 7; std::vector<ContinuousIndexType> indicesList; - while (i<static_cast<unsigned int>(argc) && (i+1)<static_cast<unsigned int>(argc)) - { + while (i < static_cast<unsigned int>(argc) && (i + 1) < static_cast<unsigned int>(argc)) + { ContinuousIndexType idx; - idx[0]=atof(argv[i]); - idx[1]=atof(argv[i+1]); + idx[0] = atof(argv[i]); + idx[1] = atof(argv[i + 1]); indicesList.push_back(idx); - i+=2; - } + i += 2; + } // Instantiating object InterpolatorType::Pointer prolate = InterpolatorType::New(); - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); reader->Update(); prolate->SetInputImage(reader->GetOutput()); @@ -69,21 +69,20 @@ int otbProlateInterpolateImageFunction(int argc, char * argv[]) std::ofstream file; file.open(outfname); - - for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it) - { - file<<(*it)<<" -> "<<prolate->EvaluateAtContinuousIndex((*it))<<std::endl; - } + for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin(); it != indicesList.end(); ++it) + { + file << (*it) << " -> " << prolate->EvaluateAtContinuousIndex((*it)) << std::endl; + } file.close(); /**********************************************************/ //typedef otb::StreamingImageFileWriter<ImageType> WriterType; //typedef otb::StreamingResampleImageFilter<ImageType,ImageType,double> StreamingResampleImageFilterType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::ResampleImageFilter<ImageType,ImageType,double> StreamingResampleImageFilterType; - WriterType::Pointer prowriter = WriterType::New(); + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::ResampleImageFilter<ImageType, ImageType, double> StreamingResampleImageFilterType; + WriterType::Pointer prowriter = WriterType::New(); StreamingResampleImageFilterType::Pointer proresampler = StreamingResampleImageFilterType::New(); - InterpolatorType::Pointer pro = InterpolatorType::New(); + InterpolatorType::Pointer pro = InterpolatorType::New(); // Resampler connected to input image proresampler->SetInput(reader->GetOutput()); pro->SetInputImage(reader->GetOutput()); @@ -92,8 +91,8 @@ int otbProlateInterpolateImageFunction(int argc, char * argv[]) proresampler->SetInterpolator(pro); StreamingResampleImageFilterType::SizeType size; - size[0]=512; - size[1]=512; + size[0] = 512; + size[1] = 512; double tutu = 1; proresampler->SetSize(size); proresampler->SetOutputSpacing(tutu); @@ -107,12 +106,12 @@ int otbProlateInterpolateImageFunction(int argc, char * argv[]) typedef itk::Function::CosineWindowFunction<1, double, double> itkCosType; typedef itk::WindowedSincInterpolateImageFunction<ImageType, 1, itkCosType> itkCosInterpolatorType; - WriterType::Pointer itkcoswriter = WriterType::New(); - WriterType::Pointer coswriter = WriterType::New(); + WriterType::Pointer itkcoswriter = WriterType::New(); + WriterType::Pointer coswriter = WriterType::New(); StreamingResampleImageFilterType::Pointer cosresampler = StreamingResampleImageFilterType::New(); StreamingResampleImageFilterType::Pointer itkcosresampler = StreamingResampleImageFilterType::New(); - CosInterpolatorType::Pointer cos = CosInterpolatorType::New(); - itkCosInterpolatorType::Pointer itkcos = itkCosInterpolatorType::New(); + CosInterpolatorType::Pointer cos = CosInterpolatorType::New(); + itkCosInterpolatorType::Pointer itkcos = itkCosInterpolatorType::New(); cosresampler->SetSize(size); cosresampler->SetOutputSpacing(tutu); itkcosresampler->SetSize(size); @@ -131,6 +130,5 @@ int otbProlateInterpolateImageFunction(int argc, char * argv[]) coswriter->Update(); itkcoswriter->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbProlateInterpolateImageFunctionNew.cxx b/Testing/Code/BasicFilters/otbProlateInterpolateImageFunctionNew.cxx index d348b1444e..3792293139 100644 --- a/Testing/Code/BasicFilters/otbProlateInterpolateImageFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbProlateInterpolateImageFunctionNew.cxx @@ -22,8 +22,8 @@ int otbProlateInterpolateImageFunctionNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::ProlateInterpolateImageFunction<ImageType> ProlateInterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::ProlateInterpolateImageFunction<ImageType> ProlateInterpolatorType; // Instantiating object ProlateInterpolatorType::Pointer prolate = ProlateInterpolatorType::New(); diff --git a/Testing/Code/BasicFilters/otbProlateValidationTest.cxx b/Testing/Code/BasicFilters/otbProlateValidationTest.cxx index 59cfc3f224..e23088a7c0 100644 --- a/Testing/Code/BasicFilters/otbProlateValidationTest.cxx +++ b/Testing/Code/BasicFilters/otbProlateValidationTest.cxx @@ -25,21 +25,20 @@ #include "otbStreamingImageFileWriter.h" #include "otbStreamingResampleImageFilter.h" - int otbProlateValidationTest(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; + const char * infname = argv[1]; + const char * outfname = argv[2]; const unsigned int rad = atoi(argv[3]); - const double factor= atof(argv[4]); + const double factor = atof(argv[4]); //const char * defaultoutfname = argv[6]; - typedef otb::Image<double,2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; - typedef otb::StreamingResampleImageFilter<ImageType,ImageType,double> StreamingResampleImageFilterType; + typedef otb::Image<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::StreamingResampleImageFilter<ImageType, ImageType, double> StreamingResampleImageFilterType; - typedef otb::ProlateInterpolateImageFunction<ImageType> InterpolatorType; + typedef otb::ProlateInterpolateImageFunction<ImageType> InterpolatorType; //typedef InterpolatorType::FunctionType FunctionType; //typedef itk::NearestNeighborInterpolateImageFunction<ImageType,double> DefaultInterpolatorType; //DefaultInterpolatorType::Pointer def = DefaultInterpolatorType::New(); @@ -52,27 +51,26 @@ int otbProlateValidationTest(int argc, char * argv[]) reader->SetFileName(infname); reader->UpdateOutputInformation(); - ImageType::PointType origin = reader->GetOutput()->GetOrigin(); + ImageType::PointType origin = reader->GetOutput()->GetOrigin(); ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); ImageType::SpacingType newSpacing; - newSpacing[0]=spacing[0]*factor; - newSpacing[1]=spacing[1]*factor; + newSpacing[0] = spacing[0] * factor; + newSpacing[1] = spacing[1] * factor; prolate->SetInputImage(reader->GetOutput()); prolate->SetRadius(rad); prolate->Initialize(); - - std::cout<<"Originalprofilsize: "<< prolate->GetFunction().GetOriginalProfileSize()<<std::endl; - std::cout<<"Energy : "<<prolate->GetFunction().ComputeEnergy(1/factor)<<std::endl; - std::cout<<"Radius : "<<prolate->GetRadius()<<std::endl; - std::cout<<"Factor : "<<factor<<std::endl; + std::cout << "Originalprofilsize: " << prolate->GetFunction().GetOriginalProfileSize() << std::endl; + std::cout << "Energy : " << prolate->GetFunction().ComputeEnergy(1 / factor) << std::endl; + std::cout << "Radius : " << prolate->GetRadius() << std::endl; + std::cout << "Factor : " << factor << std::endl; proresampler->SetInput(reader->GetOutput()); proresampler->SetInterpolator(prolate); StreamingResampleImageFilterType::SizeType size; - size[0]=atoi(argv[5]); - size[1]=atoi(argv[5]); + size[0] = atoi(argv[5]); + size[1] = atoi(argv[5]); proresampler->SetSize(size); proresampler->SetOutputOrigin(origin); proresampler->SetOutputSpacing(newSpacing); @@ -81,6 +79,5 @@ int otbProlateValidationTest(int argc, char * argv[]) prowriter->SetFileName(outfname); prowriter->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbResampleSLCImage.cxx b/Testing/Code/BasicFilters/otbResampleSLCImage.cxx index beeb8823ef..fdca2b2126 100644 --- a/Testing/Code/BasicFilters/otbResampleSLCImage.cxx +++ b/Testing/Code/BasicFilters/otbResampleSLCImage.cxx @@ -33,19 +33,19 @@ int otbResampleSLCImage(int argc, char * argv[]) typedef std::complex<double> OutputPixelType; // typedef double InterpolatorPrecisionType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; - typedef itk::TranslationTransform<double, Dimension> TransformType; + typedef itk::TranslationTransform<double, Dimension> TransformType; // typedef otb::StreamingResampleImageFilter<InputImageType,OutputImageType,InterpolatorPrecisionType> StreamingResampleImageFilterType; - typedef itk::ResampleImageFilter< InputImageType,OutputImageType > ResampleFilterType; + typedef itk::ResampleImageFilter<InputImageType, OutputImageType> ResampleFilterType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); ResampleFilterType::Pointer resampler = ResampleFilterType::New(); - TransformType::Pointer transform = TransformType::New(); + TransformType::Pointer transform = TransformType::New(); // Input Image reader->SetFileName(inputFilename); @@ -55,8 +55,8 @@ int otbResampleSLCImage(int argc, char * argv[]) // Size of output resampler result ResampleFilterType::SizeType size; - size[0]=200; - size[1]=200; + size[0] = 200; + size[1] = 200; resampler->SetSize(size); // Transformation creation @@ -75,6 +75,5 @@ int otbResampleSLCImage(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbScalarImageTextureFunctor.cxx b/Testing/Code/BasicFilters/otbScalarImageTextureFunctor.cxx index 199f1cd052..2680eef83b 100644 --- a/Testing/Code/BasicFilters/otbScalarImageTextureFunctor.cxx +++ b/Testing/Code/BasicFilters/otbScalarImageTextureFunctor.cxx @@ -24,21 +24,20 @@ #include "itkConstNeighborhoodIterator.h" #include "otbUnaryFunctorNeighborhoodImageFilter.h" - int otbScalarImageTextureFunctor(int argc, char * argv[]) { typedef double InputPixelType; const char * inputfilename(argv[1]); const char * outputfilename(argv[2]); - const int radius(atoi(argv[3])); - const int indexfeature(atoi(argv[4])); + const int radius(atoi(argv[3])); + const int indexfeature(atoi(argv[4])); const int Dimension = 2; - typedef otb::Image<InputPixelType,Dimension> InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef itk::ConstNeighborhoodIterator<InputImageType> IterType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::StreamingImageFileWriter<InputImageType> WriterType; + typedef itk::ConstNeighborhoodIterator<InputImageType> IterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<InputImageType> WriterType; WriterType::Pointer writer = WriterType::New(); ReaderType::Pointer reader = ReaderType::New(); @@ -46,10 +45,10 @@ int otbScalarImageTextureFunctor(int argc, char * argv[]) writer->SetFileName(outputfilename); + typedef otb::Functor::ScalarImageTextureFunctor<IterType, InputImageType, InputPixelType> FunctorType; - typedef otb::Functor::ScalarImageTextureFunctor<IterType, InputImageType, InputPixelType> FunctorType; - - typedef otb::UnaryFunctorNeighborhoodImageFilter<InputImageType, InputImageType, FunctorType> UnaryFunctorNeighborhoodImageFilterType; + typedef otb::UnaryFunctorNeighborhoodImageFilter<InputImageType, InputImageType, + FunctorType> UnaryFunctorNeighborhoodImageFilterType; // Instantiating object UnaryFunctorNeighborhoodImageFilterType::Pointer object = UnaryFunctorNeighborhoodImageFilterType::New(); diff --git a/Testing/Code/BasicFilters/otbScalarImageTextureFunctorNew.cxx b/Testing/Code/BasicFilters/otbScalarImageTextureFunctorNew.cxx index e9f5693f2d..3486e97d91 100644 --- a/Testing/Code/BasicFilters/otbScalarImageTextureFunctorNew.cxx +++ b/Testing/Code/BasicFilters/otbScalarImageTextureFunctorNew.cxx @@ -22,20 +22,20 @@ #include "itkConstNeighborhoodIterator.h" #include "otbUnaryFunctorNeighborhoodImageFilter.h" - int otbScalarImageTextureFunctorNew(int argc, char * argv[]) { typedef double InputPixelType; const int Dimension = 2; - typedef otb::Image<InputPixelType,Dimension> InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef itk::ConstNeighborhoodIterator<InputImageType> IterType; + typedef itk::ConstNeighborhoodIterator<InputImageType> IterType; //typedef itk::Statistics::ScalarImageTextureCalculator< InputImageType > TextureCalcType; //typedef TextureCalcType::FeatureValueVectorPointer TextureCalcType; - typedef otb::Functor::ScalarImageTextureFunctor<IterType, InputImageType, InputPixelType> FunctorType; + typedef otb::Functor::ScalarImageTextureFunctor<IterType, InputImageType, InputPixelType> FunctorType; - typedef otb::UnaryFunctorNeighborhoodImageFilter<InputImageType, InputImageType, FunctorType> UnaryFunctorNeighborhoodImageFilterType; + typedef otb::UnaryFunctorNeighborhoodImageFilter<InputImageType, InputImageType, + FunctorType> UnaryFunctorNeighborhoodImageFilterType; // Instantiating object UnaryFunctorNeighborhoodImageFilterType::Pointer object = UnaryFunctorNeighborhoodImageFilterType::New(); diff --git a/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctor.cxx b/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctor.cxx index 27d032014a..8e116eae7a 100644 --- a/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctor.cxx +++ b/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctor.cxx @@ -24,7 +24,6 @@ #define ITK_LEAN_AND_MEAN #endif - #include "otbImage.h" #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" @@ -46,11 +45,10 @@ int otbScalarToRainbowRGBPixelFunctor(int argc, char * argv[]) reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); - typedef otb::Functor::ScalarToRainbowRGBPixelFunctor<PixelType> ColorMapFunctorType; typedef itk::UnaryFunctorImageFilter<ImageType, - RGBImageType, ColorMapFunctorType> ColorMapFilterType; + RGBImageType, ColorMapFunctorType> ColorMapFilterType; ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->GetFunctor().SetMaximumInputValue(150); colormapper->GetFunctor().SetMinimumInputValue(70); @@ -60,6 +58,5 @@ int otbScalarToRainbowRGBPixelFunctor(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctorNew.cxx b/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctorNew.cxx index ec036d3f45..5b2bb44a7c 100644 --- a/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctorNew.cxx +++ b/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctorNew.cxx @@ -24,7 +24,6 @@ #define ITK_LEAN_AND_MEAN #endif - #include "otbImage.h" #include "itkUnaryFunctorImageFilter.h" @@ -33,19 +32,18 @@ int otbScalarToRainbowRGBPixelFunctorNew(int argc, char * argv[]) { - typedef unsigned char PixelType; - typedef itk::RGBPixel<PixelType> RGBPixelType; - typedef otb::Image<PixelType, 2> ImageType; + typedef unsigned char PixelType; + typedef itk::RGBPixel<PixelType> RGBPixelType; + typedef otb::Image<PixelType, 2> ImageType; typedef otb::Image<RGBPixelType, 2> RGBImageType; typedef otb::Functor::ScalarToRainbowRGBPixelFunctor<PixelType> ColorMapFunctorType; typedef itk::UnaryFunctorImageFilter<ImageType, - RGBImageType, ColorMapFunctorType> ColorMapFilterType; + RGBImageType, ColorMapFunctorType> ColorMapFilterType; ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->GetFunctor().SetMaximum(150); colormapper->GetFunctor().SetMinimum(70); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbScalarVectorImageTextureFunctor.cxx b/Testing/Code/BasicFilters/otbScalarVectorImageTextureFunctor.cxx index 55d7b470cb..6bb5f091b3 100644 --- a/Testing/Code/BasicFilters/otbScalarVectorImageTextureFunctor.cxx +++ b/Testing/Code/BasicFilters/otbScalarVectorImageTextureFunctor.cxx @@ -25,33 +25,34 @@ #include "itkConstNeighborhoodIterator.h" #include "otbUnaryFunctorNeighborhoodImageFilter.h" - int otbScalarVectorImageTextureFunctor(int argc, char * argv[]) { typedef double InputPixelType; const char * inputfilename(argv[1]); const char * outputfilename(argv[2]); - const int radius(atoi(argv[3])); + const int radius(atoi(argv[3])); // const int indexfeature(atoi(argv[4])); const int Dimension = 2; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::VectorImage<InputPixelType,Dimension> OutputVectorImageType; - typedef OutputVectorImageType::PixelType OutputVectorImagePixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> OutputVectorImageType; + typedef OutputVectorImageType::PixelType OutputVectorImagePixelType; - typedef itk::ConstNeighborhoodIterator<InputImageType> IterType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef itk::ConstNeighborhoodIterator<InputImageType> IterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::StreamingImageFileWriter<OutputVectorImageType> WriterType; - typedef otb::Functor::ScalarVectorImageTextureFunctor<IterType, InputImageType, OutputVectorImagePixelType> FunctorType; + typedef otb::Functor::ScalarVectorImageTextureFunctor<IterType, InputImageType, + OutputVectorImagePixelType> FunctorType; typedef FunctorType::IndexSelectFeaturesType ListIndexType; - typedef otb::UnaryFunctorNeighborhoodImageFilter<InputImageType, OutputVectorImageType, FunctorType> UnaryFunctorNeighborhoodImageFilterType; + typedef otb::UnaryFunctorNeighborhoodImageFilter<InputImageType, OutputVectorImageType, + FunctorType> UnaryFunctorNeighborhoodImageFilterType; // Instantiating object UnaryFunctorNeighborhoodImageFilterType::Pointer object = UnaryFunctorNeighborhoodImageFilterType::New(); - WriterType::Pointer writer = WriterType::New(); - ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); ListIndexType listIndexFeature; listIndexFeature.push_back(0); @@ -66,7 +67,6 @@ int otbScalarVectorImageTextureFunctor(int argc, char * argv[]) writer->SetFileName(outputfilename); - writer->Update(); return EXIT_SUCCESS; diff --git a/Testing/Code/BasicFilters/otbScalarVectorImageTextureFunctorNew.cxx b/Testing/Code/BasicFilters/otbScalarVectorImageTextureFunctorNew.cxx index 5daed7bd46..29c4ad7a02 100644 --- a/Testing/Code/BasicFilters/otbScalarVectorImageTextureFunctorNew.cxx +++ b/Testing/Code/BasicFilters/otbScalarVectorImageTextureFunctorNew.cxx @@ -23,22 +23,22 @@ #include "itkConstNeighborhoodIterator.h" #include "otbUnaryFunctorNeighborhoodImageFilter.h" - int otbScalarVectorImageTextureFunctorNew(int argc, char * argv[]) { typedef double InputPixelType; const int Dimension = 2; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::VectorImage<InputPixelType,Dimension> InputVectorImageType; - typedef InputVectorImageType::PixelType VectorImagePixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputVectorImageType; + typedef InputVectorImageType::PixelType VectorImagePixelType; - typedef itk::ConstNeighborhoodIterator<InputImageType> IterType; + typedef itk::ConstNeighborhoodIterator<InputImageType> IterType; //typedef itk::Statistics::ScalarImageTextureCalculator< InputImageType > TextureCalcType; //typedef TextureCalcType::FeatureValueVectorPointer TextureCalcType; - typedef otb::Functor::ScalarVectorImageTextureFunctor<IterType, InputImageType, VectorImagePixelType> FunctorType; + typedef otb::Functor::ScalarVectorImageTextureFunctor<IterType, InputImageType, VectorImagePixelType> FunctorType; - typedef otb::UnaryFunctorNeighborhoodImageFilter<InputImageType, InputVectorImageType, FunctorType> UnaryFunctorNeighborhoodImageFilterType; + typedef otb::UnaryFunctorNeighborhoodImageFilter<InputImageType, InputVectorImageType, + FunctorType> UnaryFunctorNeighborhoodImageFilterType; // Instantiating object UnaryFunctorNeighborhoodImageFilterType::Pointer object = UnaryFunctorNeighborhoodImageFilterType::New(); diff --git a/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.cxx b/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.cxx index aee931ef46..5b7383f6c9 100644 --- a/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.cxx +++ b/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.cxx @@ -24,29 +24,29 @@ int otbSpatialObjectToImageDrawingFilter(int argc, char * argv[]) { - const char * outputFilename = argv[1]; - const double radiusx = atof(argv[2]); - const double radiusy = atof(argv[3]); + const char * outputFilename = argv[1]; + const double radiusx = atof(argv[2]); + const double radiusy = atof(argv[3]); const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::EllipseSpatialObject<Dimension> SpatialObjectType; - typedef otb::SpatialObjectToImageDrawingFilter<SpatialObjectType,ImageType> SpatialObjectToImageDrawingFilterType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::EllipseSpatialObject<Dimension> SpatialObjectType; + typedef otb::SpatialObjectToImageDrawingFilter<SpatialObjectType, ImageType> SpatialObjectToImageDrawingFilterType; // Instantiating object SpatialObjectToImageDrawingFilterType::Pointer filter = SpatialObjectToImageDrawingFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); - SpatialObjectType::Pointer ellipse = SpatialObjectType::New(); + SpatialObjectType::Pointer ellipse = SpatialObjectType::New(); SpatialObjectType::ArrayType radius; - radius[0]=radiusx; - radius[1]=radiusy; + radius[0] = radiusx; + radius[1] = radiusy; ellipse->SetRadius(radius); ImageType::PointType origin; - origin[0]=-radiusx; - origin[1]=-radiusy; + origin[0] = -radiusx; + origin[1] = -radiusy; filter->SetInput(ellipse); filter->SetOrigin(origin); filter->SetInsideValue(255); @@ -56,6 +56,5 @@ int otbSpatialObjectToImageDrawingFilter(int argc, char * argv[]) writer->SetFileName(outputFilename); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilterNew.cxx b/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilterNew.cxx index fb2f2647db..37c71a2e10 100644 --- a/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilterNew.cxx @@ -24,13 +24,12 @@ int otbSpatialObjectToImageDrawingFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::GroupSpatialObject<Dimension> SpatialObjectType; - typedef otb::SpatialObjectToImageDrawingFilter<SpatialObjectType,ImageType> SpatialObjectToImageDrawingFilterType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::GroupSpatialObject<Dimension> SpatialObjectType; + typedef otb::SpatialObjectToImageDrawingFilter<SpatialObjectType, ImageType> SpatialObjectToImageDrawingFilterType; // Instantiating object SpatialObjectToImageDrawingFilterType::Pointer object = SpatialObjectToImageDrawingFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilter.cxx b/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilter.cxx index ceeec0b106..9a3e4bbac4 100644 --- a/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilter.cxx @@ -25,17 +25,17 @@ int otbSpectralAngleDistanceImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::SpectralAngleDistanceImageFilter<InputImageType,OutputImageType> DistanceFilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::SpectralAngleDistanceImageFilter<InputImageType, OutputImageType> DistanceFilterType; // Instantiating object DistanceFilterType::Pointer filter = DistanceFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); @@ -44,10 +44,10 @@ int otbSpectralAngleDistanceImageFilter(int argc, char * argv[]) reader->UpdateOutputInformation(); refPixel.SetSize(reader->GetOutput()->GetNumberOfComponentsPerPixel()); - for (unsigned int i = 0; i<reader->GetOutput()->GetNumberOfComponentsPerPixel();++i) - { - refPixel[i]=atoi(argv[3+i]); - } + for (unsigned int i = 0; i < reader->GetOutput()->GetNumberOfComponentsPerPixel(); ++i) + { + refPixel[i] = atoi(argv[3 + i]); + } filter->SetInput(reader->GetOutput()); filter->SetReferencePixel(refPixel); @@ -55,6 +55,5 @@ int otbSpectralAngleDistanceImageFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilterNew.cxx b/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilterNew.cxx index 6a60a666aa..7ab3b604ff 100644 --- a/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilterNew.cxx @@ -23,14 +23,13 @@ int otbSpectralAngleDistanceImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef otb::SpectralAngleDistanceImageFilter<InputImageType,OutputImageType> DistanceFilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef otb::SpectralAngleDistanceImageFilter<InputImageType, OutputImageType> DistanceFilterType; // Instantiating object DistanceFilterType::Pointer object = DistanceFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilter.cxx b/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilter.cxx index 1a3b10a97d..2987a0f636 100644 --- a/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilter.cxx @@ -20,21 +20,21 @@ #include "otbImageFileReader.h" #include <fstream> -int otbStreamingInnerProductVectorImageFilter( int argc, char* argv[] ) +int otbStreamingInnerProductVectorImageFilter(int argc, char* argv[]) { const char * inputFileName = argv[1]; const char * outfname = argv[2]; - const bool centerdata = atoi(argv[3]); + const bool centerdata = atoi(argv[3]); typedef double PixelType; const unsigned int Dimension = 2; // Typedef - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingInnerProductVectorImageFilter<ImageType> FilterType; - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); // Instantiation object @@ -45,13 +45,12 @@ int otbStreamingInnerProductVectorImageFilter( int argc, char* argv[] ) filter->SetInput(reader->GetOutput()); filter->Update(); - std::ofstream file; file.open(outfname); file.precision(10); - file<<std::fixed; - file<<"Inner Product: Dim ["<<filter->GetInnerProduct().size()<<"]:"<<std::endl; - file<<filter->GetInnerProduct()<<std::endl; + file << std::fixed; + file << "Inner Product: Dim [" << filter->GetInnerProduct().size() << "]:" << std::endl; + file << filter->GetInnerProduct() << std::endl; file.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilterNew.cxx b/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilterNew.cxx index c95e3b01d6..669047bdc4 100644 --- a/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilterNew.cxx @@ -18,13 +18,13 @@ #include "otbStreamingInnerProductVectorImageFilter.h" #include "otbVectorImage.h" -int otbStreamingInnerProductVectorImageFilterNew( int argc, char* argv[] ) +int otbStreamingInnerProductVectorImageFilterNew(int argc, char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; // Typedef - typedef otb::VectorImage<PixelType,Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; typedef otb::StreamingInnerProductVectorImageFilter<ImageType> FilterType; // Instantiation object diff --git a/Testing/Code/BasicFilters/otbStreamingResampleImageFilter.cxx b/Testing/Code/BasicFilters/otbStreamingResampleImageFilter.cxx index 2e76c40596..8766552f5e 100644 --- a/Testing/Code/BasicFilters/otbStreamingResampleImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbStreamingResampleImageFilter.cxx @@ -29,22 +29,23 @@ int otbStreamingResampleImageFilter(int argc, char * argv[]) const char* outputFilename = argv[2]; const unsigned int Dimension = 2; - typedef double InputPixelType; + typedef double InputPixelType; typedef unsigned char OutputPixelType; - typedef double InterpolatorPrecisionType; + typedef double InterpolatorPrecisionType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; - typedef itk::TranslationTransform<InputPixelType,Dimension> TransformType; - typedef otb::StreamingResampleImageFilter<InputImageType,OutputImageType,InterpolatorPrecisionType> StreamingResampleImageFilterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; + typedef itk::TranslationTransform<InputPixelType, Dimension> TransformType; + typedef otb::StreamingResampleImageFilter<InputImageType, OutputImageType, + InterpolatorPrecisionType> StreamingResampleImageFilterType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); StreamingResampleImageFilterType::Pointer resampler = StreamingResampleImageFilterType::New(); - TransformType::Pointer transform = TransformType::New(); + TransformType::Pointer transform = TransformType::New(); // Input Image reader->SetFileName(inputFilename); @@ -54,8 +55,8 @@ int otbStreamingResampleImageFilter(int argc, char * argv[]) // Size of output resampler result StreamingResampleImageFilterType::SizeType size; - size[0]=600; - size[1]=600; + size[0] = 600; + size[1] = 600; resampler->SetSize(size); // Transformation creation @@ -74,6 +75,5 @@ int otbStreamingResampleImageFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx b/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx index 13eb62597e..12f4027dbe 100644 --- a/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx +++ b/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx @@ -29,33 +29,34 @@ int otbStreamingResampleImageFilterCompareWithITK(int argc, char * argv[]) { - const char* inputFilename = argv[1]; + const char* inputFilename = argv[1]; unsigned int sizeXOutputImage = atoi(argv[2]); unsigned int sizeYOutputImage = atoi(argv[3]); - const char* outputITKFilename = argv[4]; - const char* outputOTBFilename = argv[5]; - + const char* outputITKFilename = argv[4]; + const char* outputOTBFilename = argv[5]; const unsigned int Dimension = 2; typedef double InputPixelType; typedef double OutputPixelType; typedef double InterpolatorPrecisionType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; // typedef otb::VectorImage<OutputPixelType,Dimension> InputVectorImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::StreamingImageFileWriter<OutputImageType> StreamingWriterType; - typedef itk::TranslationTransform<InputPixelType,Dimension> TransformType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::StreamingImageFileWriter<OutputImageType> StreamingWriterType; + typedef itk::TranslationTransform<InputPixelType, Dimension> TransformType; typedef itk::NearestNeighborInterpolateImageFunction<InputImageType, InterpolatorPrecisionType> NNInterpolatorType; - typedef itk::ResampleImageFilter<InputImageType,OutputImageType,InterpolatorPrecisionType> ITKResampleImageFilterType; - typedef otb::StreamingResampleImageFilter<InputImageType,OutputImageType,InterpolatorPrecisionType> OTBResampleImageFilterType; + typedef itk::ResampleImageFilter<InputImageType, OutputImageType, + InterpolatorPrecisionType> ITKResampleImageFilterType; + typedef otb::StreamingResampleImageFilter<InputImageType, OutputImageType, + InterpolatorPrecisionType> OTBResampleImageFilterType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writerITKFilter = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writerITKFilter = WriterType::New(); StreamingWriterType::Pointer writerOTBFilter = StreamingWriterType::New(); ITKResampleImageFilterType::Pointer resamplerITK = ITKResampleImageFilterType::New(); @@ -77,8 +78,8 @@ int otbStreamingResampleImageFilterCompareWithITK(int argc, char * argv[]) // Size of output resamplers result OTBResampleImageFilterType::SizeType size; - size[0]=sizeXOutputImage; - size[1]=sizeYOutputImage; + size[0] = sizeXOutputImage; + size[1] = sizeYOutputImage; resamplerITK->SetSize(size); resamplerOTB->SetSize(size); @@ -104,6 +105,5 @@ int otbStreamingResampleImageFilterCompareWithITK(int argc, char * argv[]) writerOTBFilter->SetNumberOfStreamDivisions(10); writerOTBFilter->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingResampleImageFilterNew.cxx b/Testing/Code/BasicFilters/otbStreamingResampleImageFilterNew.cxx index f3f316cb00..39d9dd740c 100644 --- a/Testing/Code/BasicFilters/otbStreamingResampleImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbStreamingResampleImageFilterNew.cxx @@ -23,17 +23,17 @@ int otbStreamingResampleImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef double InterpolatorPrecisionType; + typedef double InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef double InterpolatorPrecisionType; - typedef otb::StreamingResampleImageFilter<InputImageType,OutputImageType,InterpolatorPrecisionType> StreamingResampleImageFilterType; + typedef otb::StreamingResampleImageFilter<InputImageType, OutputImageType, + InterpolatorPrecisionType> StreamingResampleImageFilterType; // Instantiating object StreamingResampleImageFilterType::Pointer object = StreamingResampleImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx b/Testing/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx index cbb7b726ef..b0e6268915 100644 --- a/Testing/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx @@ -20,19 +20,18 @@ #include "otbVectorImage.h" #include "otbStreamingShrinkImageFilter.h" - -int otbStreamingShrinkImageFilter( int argc, char * argv[] ) +int otbStreamingShrinkImageFilter(int argc, char * argv[]) { - char * inputFilename = argv[1]; - char * outputFilename = argv[2]; - unsigned int shrinkFactor = atoi(argv[3]); + char * inputFilename = argv[1]; + char * outputFilename = argv[2]; + unsigned int shrinkFactor = atoi(argv[3]); const unsigned int Dimension = 2; - typedef unsigned int PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::StreamingShrinkImageFilter<ImageType,ImageType> ShrinkType; + typedef unsigned int PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::StreamingShrinkImageFilter<ImageType, ImageType> ShrinkType; ReaderType::Pointer reader = ReaderType::New(); ShrinkType::Pointer shrink = ShrinkType::New(); @@ -47,6 +46,5 @@ int otbStreamingShrinkImageFilter( int argc, char * argv[] ) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingShrinkImageFilterNew.cxx b/Testing/Code/BasicFilters/otbStreamingShrinkImageFilterNew.cxx index c54498801d..dfd1c3c577 100644 --- a/Testing/Code/BasicFilters/otbStreamingShrinkImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbStreamingShrinkImageFilterNew.cxx @@ -18,17 +18,15 @@ #include "otbVectorImage.h" #include "otbStreamingShrinkImageFilter.h" - -int otbStreamingShrinkImageFilterNew( int argc, char * argv[] ) +int otbStreamingShrinkImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::StreamingShrinkImageFilter<ImageType,ImageType> ShrinkType; + typedef unsigned char PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::StreamingShrinkImageFilter<ImageType, ImageType> ShrinkType; ShrinkType::Pointer shrink = ShrinkType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilter.cxx b/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilter.cxx index a469903a25..adb2fc6c71 100644 --- a/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilter.cxx @@ -32,8 +32,8 @@ int otbStreamingStatisticsImageFilter(int argc, char * argv[]) const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingStatisticsImageFilter<ImageType> StreamingStatisticsImageFilterType; //typedef itk::StatisticsImageFilter<ImageType> StreamingStatisticsImageFilterType; // Instantiating object @@ -49,16 +49,15 @@ int otbStreamingStatisticsImageFilter(int argc, char * argv[]) std::ofstream file; file.open(outfname); - file<<"Minimum: "<<filter->GetMinimum()<<std::endl; - file<<"Maximum: "<<filter->GetMaximum()<<std::endl; - file<<std::fixed; + file << "Minimum: " << filter->GetMinimum() << std::endl; + file << "Maximum: " << filter->GetMaximum() << std::endl; + file << std::fixed; file.precision(5); - file<<"Sum: "<<filter->GetSum()<<std::endl; - file<<"Mean: "<<filter->GetMean()<<std::endl; - file<<"Sigma: "<<filter->GetSigma()<<std::endl; - file<<"Variance: "<<filter->GetVariance()<<std::endl; + file << "Sum: " << filter->GetSum() << std::endl; + file << "Mean: " << filter->GetMean() << std::endl; + file << "Sigma: " << filter->GetSigma() << std::endl; + file << "Variance: " << filter->GetVariance() << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilterNew.cxx b/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilterNew.cxx index 482c73914d..dc4a663930 100644 --- a/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilterNew.cxx @@ -25,12 +25,11 @@ int otbStreamingStatisticsImageFilterNew(int argc, char * argv[]) const unsigned int Dimension = 2; typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; + typedef otb::Image<PixelType, Dimension> ImageType; typedef otb::StreamingStatisticsImageFilter<ImageType> StreamingStatisticsImageFilterType; // Instantiating object StreamingStatisticsImageFilterType::Pointer object = StreamingStatisticsImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilter.cxx b/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilter.cxx index 4ab0883e3f..e0c312c80b 100644 --- a/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilter.cxx @@ -31,14 +31,13 @@ int otbStreamingStatisticsVectorImageFilter(int argc, char * argv[]) const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingStatisticsVectorImageFilter<ImageType> StreamingStatisticsVectorImageFilterType; // Instantiating object StreamingStatisticsVectorImageFilterType::Pointer filter = StreamingStatisticsVectorImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -47,18 +46,16 @@ int otbStreamingStatisticsVectorImageFilter(int argc, char * argv[]) filter->SetInput(reader->GetOutput()); filter->Update(); - std::ofstream file; file.open(outfname); - file<<"Minimum: "<<filter->GetMinimum()<<std::endl; - file<<"Maximum: "<<filter->GetMaximum()<<std::endl; - file<<std::fixed; + file << "Minimum: " << filter->GetMinimum() << std::endl; + file << "Maximum: " << filter->GetMaximum() << std::endl; + file << std::fixed; file.precision(5); - file<<"Sum: "<<filter->GetSum()<<std::endl; - file<<"Mean: "<<filter->GetMean()<<std::endl; - file<<"Covariance: "<<filter->GetCovariance()<<std::endl; + file << "Sum: " << filter->GetSum() << std::endl; + file << "Mean: " << filter->GetMean() << std::endl; + file << "Covariance: " << filter->GetCovariance() << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilterNew.cxx b/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilterNew.cxx index d02d8201ef..ceaf3664ec 100644 --- a/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilterNew.cxx @@ -25,12 +25,11 @@ int otbStreamingStatisticsVectorImageFilterNew(int argc, char * argv[]) const unsigned int Dimension = 2; typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; typedef otb::StreamingStatisticsVectorImageFilter<ImageType> StreamingStatisticsVectorImageFilterType; // Instantiating object StreamingStatisticsVectorImageFilterType::Pointer object = StreamingStatisticsVectorImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbTransformPointSetFilterTest.cxx b/Testing/Code/BasicFilters/otbTransformPointSetFilterTest.cxx index 7c866f450e..0cafc2fa1f 100644 --- a/Testing/Code/BasicFilters/otbTransformPointSetFilterTest.cxx +++ b/Testing/Code/BasicFilters/otbTransformPointSetFilterTest.cxx @@ -23,95 +23,92 @@ #include "itkPointSet.h" #include "itkAffineTransform.h" -int otbTransformPointSetFilterTest(int, char* [] ) +int otbTransformPointSetFilterTest(int, char*[]) { // Declare the PointSet pixel type. - // Those are the values associated + // Those are the values associated // with each PointSet point. (not used on this filter test) typedef int PixelType; - + // Declare the types of the PointSet // By default it is a 3D PointSet using itk::Point<float,3> // on the vertices, and an itk::VectorContainter // as containter for points - typedef itk::PointSet<PixelType> PointSetType; + typedef itk::PointSet<PixelType> PointSetType; // Declare the type for PointsContainer - typedef PointSetType::PointsContainer PointsContainerType; + typedef PointSetType::PointsContainer PointsContainerType; // Declare the type for PointsContainerPointer typedef PointSetType::PointsContainerPointer - PointsContainerPointer; + PointsContainerPointer; // Declare the type for Points - typedef PointSetType::PointType PointType; + typedef PointSetType::PointType PointType; // Create an input PointSet PointSetType::Pointer inputPointSet = PointSetType::New(); // Insert data on the PointSet - PointsContainerPointer points = inputPointSet->GetPoints(); + PointsContainerPointer points = inputPointSet->GetPoints(); // Fill a cube with points , just to get some data - int n = 1; // let's start with a few of them - PointsContainerType::ElementIdentifier count = 0; // count them + int n = 1; // let's start with a few of them + PointsContainerType::ElementIdentifier count = 0; // count them - for(int x= -n; x <= n; x++) + for (int x = -n; x <= n; x++) { - for(int y= -n; y <= n; y++) + for (int y = -n; y <= n; y++) { - for(int z= -n; z <= n; z++) + for (int z = -n; z <= n; z++) { PointType p; p[0] = x; p[1] = y; p[2] = z; std::cout << "Inserting point # "; - std::cout.width( 3); std::cout << count << " = "; - std::cout.width( 4); std::cout << p[0] << ", "; - std::cout.width( 4); std::cout << p[1] << ", "; - std::cout.width( 4); std::cout << p[2] << std::endl; - points->InsertElement( count, p ); + std::cout.width(3); std::cout << count << " = "; + std::cout.width(4); std::cout << p[0] << ", "; + std::cout.width(4); std::cout << p[1] << ", "; + std::cout.width(4); std::cout << p[2] << std::endl; + points->InsertElement(count, p); count++; } } } - + std::cout << "Input PointSet has " << inputPointSet->GetNumberOfPoints(); std::cout << " points " << std::endl; - // Declare the transform type - typedef itk::AffineTransform<float,3> TransformType; - + typedef itk::AffineTransform<float, 3> TransformType; // Declare the type for the filter typedef otb::TransformPointSetFilter< - PointSetType, - PointSetType, - TransformType > FilterType; - + PointSetType, + PointSetType, + TransformType> FilterType; // Create a Filter FilterType::Pointer filter = FilterType::New(); - - // Create an Transform + + // Create an Transform // (it doesn't use smart pointers) - TransformType::Pointer affineTransform = TransformType::New(); - affineTransform->Scale( 3.5 ); - TransformType::OffsetType::ValueType tInit[3] = {100,200,300}; - TransformType::OffsetType translation = tInit; - affineTransform->Translate( translation ); + TransformType::Pointer affineTransform = TransformType::New(); + affineTransform->Scale(3.5); + TransformType::OffsetType::ValueType tInit[3] = {100, 200, 300}; + TransformType::OffsetType translation = tInit; + affineTransform->Translate(translation); // Connect the inputs - filter->SetInput( inputPointSet ); - filter->SetTransform( affineTransform ); + filter->SetInput(inputPointSet); + filter->SetTransform(affineTransform); // Execute the filter filter->Update(); std::cout << "Filter: " << filter; - // Get the Smart Pointer to the Filter Output + // Get the Smart Pointer to the Filter Output PointSetType::Pointer outputPointSet = filter->GetOutput(); std::cout << "Output PointSet has " << outputPointSet->GetNumberOfPoints(); @@ -119,19 +116,18 @@ int otbTransformPointSetFilterTest(int, char* [] ) // Get the the point container PointSetType::PointsContainerPointer - transformedPoints = outputPointSet->GetPoints(); - + transformedPoints = outputPointSet->GetPoints(); PointsContainerType::ConstIterator it = transformedPoints->Begin(); - while( it != transformedPoints->End() ) + while (it != transformedPoints->End()) { PointType p = it.Value(); - std::cout.width( 5 ); std::cout << p[0] << ", "; - std::cout.width( 5 ); std::cout << p[1] << ", "; - std::cout.width( 5 ); std::cout << p[2] << std::endl; + std::cout.width(5); std::cout << p[0] << ", "; + std::cout.width(5); std::cout << p[1] << ", "; + std::cout.width(5); std::cout << p[2] << std::endl; ++it; } - + // All objects should be automatically destroyed at this point return EXIT_SUCCESS; diff --git a/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilter.cxx b/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilter.cxx index b84b7f2b86..f5dba13082 100644 --- a/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilter.cxx @@ -30,21 +30,21 @@ int otbUnaryImageFunctorWithVectorImageFilter(int argc, char * argv[]) const char * outputFileName = argv[2]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef InputImageType::InternalPixelType InternalPixelType; - typedef itk::Functor::Cast<InternalPixelType,InternalPixelType> FunctorType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef InputImageType::InternalPixelType InternalPixelType; + typedef itk::Functor::Cast<InternalPixelType, InternalPixelType> FunctorType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; typedef otb::UnaryImageFunctorWithVectorImageFilter<InputImageType, - InputImageType, - FunctorType > UnaryImageFunctorWithVectorImageFilterType; + InputImageType, + FunctorType> UnaryImageFunctorWithVectorImageFilterType; // Instantiating object UnaryImageFunctorWithVectorImageFilterType::Pointer filter = UnaryImageFunctorWithVectorImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -52,6 +52,5 @@ int otbUnaryImageFunctorWithVectorImageFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilterNew.cxx b/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilterNew.cxx index 46b73bf7ff..58aa252644 100644 --- a/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilterNew.cxx @@ -25,13 +25,13 @@ int otbUnaryImageFunctorWithVectorImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef InputImageType::InternalPixelType InternalPixelType; - typedef itk::Functor::Cos<InternalPixelType,InternalPixelType> FunctorType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef InputImageType::InternalPixelType InternalPixelType; + typedef itk::Functor::Cos<InternalPixelType, InternalPixelType> FunctorType; typedef otb::UnaryImageFunctorWithVectorImageFilter<InputImageType, - InputImageType, - FunctorType > UnaryImageFunctorWithVectorImageFilterType; + InputImageType, + FunctorType> UnaryImageFunctorWithVectorImageFilterType; // Instantiating object UnaryImageFunctorWithVectorImageFilterType::Pointer filter = UnaryImageFunctorWithVectorImageFilterType::New(); diff --git a/Testing/Code/BasicFilters/otbVarianceImageFilter.cxx b/Testing/Code/BasicFilters/otbVarianceImageFilter.cxx index c45629f8a5..72c2e3766e 100644 --- a/Testing/Code/BasicFilters/otbVarianceImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbVarianceImageFilter.cxx @@ -25,10 +25,10 @@ int otbVarianceImageFilter(int argc, char * argv[]) const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VarianceImageFilter<ImageType,ImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VarianceImageFilter<ImageType, ImageType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbVarianceImageFilterNew.cxx b/Testing/Code/BasicFilters/otbVarianceImageFilterNew.cxx index ec34bf2c1b..50ef6a2ef9 100644 --- a/Testing/Code/BasicFilters/otbVarianceImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbVarianceImageFilterNew.cxx @@ -23,8 +23,8 @@ int otbVarianceImageFilterNew(int argc, char * argv[]) const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VarianceImageFilter<ImageType,ImageType> FilterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VarianceImageFilter<ImageType, ImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.cxx b/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.cxx index f2f97b9e92..7388ec4a9c 100644 --- a/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.cxx @@ -24,7 +24,6 @@ #include "itkImageRegionIterator.h" #include "itkImageSliceConstIteratorWithIndex.h" - int otbVectorImageTo3DScalarImageFilter(int argc, char * argv[]) { const unsigned int BiDimension = 2; @@ -35,13 +34,13 @@ int otbVectorImageTo3DScalarImageFilter(int argc, char * argv[]) typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType,BiDimension> VectorImageType; - typedef otb::Image<PixelType,TriDimension> ImageType; - typedef otb::Image<PixelType,BiDimension> OutImageType; + typedef otb::VectorImage<PixelType, BiDimension> VectorImageType; + typedef otb::Image<PixelType, TriDimension> ImageType; + typedef otb::Image<PixelType, BiDimension> OutImageType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<OutImageType> WriterType; - typedef otb::VectorImageTo3DScalarImageFilter<VectorImageType,ImageType> FilterType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::ImageFileWriter<OutImageType> WriterType; + typedef otb::VectorImageTo3DScalarImageFilter<VectorImageType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); @@ -57,28 +56,27 @@ int otbVectorImageTo3DScalarImageFilter(int argc, char * argv[]) outImage->Allocate(); outImage->FillBuffer(0); - typedef itk::ImageRegionIterator<OutImageType> OutIteratorType; + typedef itk::ImageRegionIterator<OutImageType> OutIteratorType; typedef itk::ImageSliceConstIteratorWithIndex<ImageType> InIteratorType; - OutIteratorType outIt(outImage,outImage->GetLargestPossibleRegion()); - InIteratorType inIt(filter->GetOutput(),filter->GetOutput()->GetLargestPossibleRegion()); + OutIteratorType outIt(outImage, outImage->GetLargestPossibleRegion()); + InIteratorType inIt(filter->GetOutput(), filter->GetOutput()->GetLargestPossibleRegion()); inIt.SetFirstDirection(0); inIt.SetSecondDirection(1); outIt.GoToBegin(); - while (!outIt.IsAtEnd()&&!inIt.IsAtEndOfSlice()) - { + while (!outIt.IsAtEnd() && !inIt.IsAtEndOfSlice()) + { outIt.Set(inIt.Get()); ++inIt; ++outIt; - } + } WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outfname); writer->SetInput(outImage); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilterNew.cxx b/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilterNew.cxx index 2a6a095a32..f41f837bdd 100644 --- a/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilterNew.cxx @@ -27,10 +27,10 @@ int otbVectorImageTo3DScalarImageFilterNew(int argc, char * argv[]) typedef double PixelType; - typedef otb::VectorImage<PixelType,BiDimension> VectorImageType; - typedef otb::Image<PixelType,TriDimension> ImageType; + typedef otb::VectorImage<PixelType, BiDimension> VectorImageType; + typedef otb::Image<PixelType, TriDimension> ImageType; - typedef otb::VectorImageTo3DScalarImageFilter<VectorImageType,ImageType> FilterType; + typedef otb::VectorImageTo3DScalarImageFilter<VectorImageType, ImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilter.cxx b/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilter.cxx index fa41dd8bd0..9176576a07 100644 --- a/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilter.cxx @@ -29,11 +29,11 @@ int otbVectorImageToAmplitudeImageFilter(int argc, char * argv[]) const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::VectorImageToAmplitudeImageFilter<VectorImageType,ImageType> FilterType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::VectorImageToAmplitudeImageFilter<VectorImageType, ImageType> FilterType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilterNew.cxx b/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilterNew.cxx index b93d8244b6..1175317469 100644 --- a/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilterNew.cxx @@ -24,9 +24,9 @@ int otbVectorImageToAmplitudeImageFilterNew(int argc, char * argv[]) const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::VectorImageToAmplitudeImageFilter<VectorImageType,ImageType> FilterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::VectorImageToAmplitudeImageFilter<VectorImageType, ImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); diff --git a/Testing/Code/BasicFilters/otbVectorImageToImageListFilter.cxx b/Testing/Code/BasicFilters/otbVectorImageToImageListFilter.cxx index 97a00ebc99..4e31f75efe 100644 --- a/Testing/Code/BasicFilters/otbVectorImageToImageListFilter.cxx +++ b/Testing/Code/BasicFilters/otbVectorImageToImageListFilter.cxx @@ -27,22 +27,21 @@ int otbVectorImageToImageListFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - char * infname = argv[1]; - char * outfname1 = argv[2]; - char * outfname2 = argv[3]; - char * outfname3 = argv[4]; + char * infname = argv[1]; + char * outfname1 = argv[2]; + char * outfname2 = argv[3]; + char * outfname3 = argv[4]; - - typedef unsigned char PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::ImageList<ImageType> ImageListType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::ImageList<ImageType> ImageListType; // IO typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::VectorImageToImageListFilter<VectorImageType,ImageListType> VectorImageToImageListFilterType; + typedef otb::VectorImageToImageListFilter<VectorImageType, ImageListType> VectorImageToImageListFilterType; // Instantiating object VectorImageToImageListFilterType::Pointer filter = VectorImageToImageListFilterType::New(); @@ -69,6 +68,5 @@ int otbVectorImageToImageListFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()->GetNthElement(2)); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbVectorImageToImageListFilterNew.cxx b/Testing/Code/BasicFilters/otbVectorImageToImageListFilterNew.cxx index eb2a3d0025..793377ddaa 100644 --- a/Testing/Code/BasicFilters/otbVectorImageToImageListFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbVectorImageToImageListFilterNew.cxx @@ -26,16 +26,15 @@ int otbVectorImageToImageListFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::ImageList<ImageType> ImageListType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::ImageList<ImageType> ImageListType; - typedef otb::VectorImageToImageListFilter<VectorImageType,ImageListType> VectorImageToImageListFilterType; + typedef otb::VectorImageToImageListFilter<VectorImageType, ImageListType> VectorImageToImageListFilterType; // Instantiating object VectorImageToImageListFilterType::Pointer object = VectorImageToImageListFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilter.cxx b/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilter.cxx index 0f3f26d5ca..04763d5042 100644 --- a/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilter.cxx @@ -25,12 +25,12 @@ int otbVectorImageToIntensityImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::VectorImageToIntensityImageFilter<InputImageType,OutputImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::VectorImageToIntensityImageFilter<InputImageType, OutputImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); @@ -48,6 +48,5 @@ int otbVectorImageToIntensityImageFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilterNew.cxx b/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilterNew.cxx index 8ac70062e3..edd9fff7f9 100644 --- a/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilterNew.cxx @@ -23,14 +23,13 @@ int otbVectorImageToIntensityImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef otb::VectorImageToIntensityImageFilter<InputImageType,OutputImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef otb::VectorImageToIntensityImageFilter<InputImageType, OutputImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilter.cxx b/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilter.cxx index 9398d377ba..df5a28502e 100644 --- a/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilter.cxx @@ -25,20 +25,20 @@ int otbVectorRescaleIntensityImageFilter(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; - const unsigned char min = atoi(argv[3]); + const char * infname = argv[1]; + const char * outfname = argv[2]; + const unsigned char min = atoi(argv[3]); const unsigned char max = atoi(argv[4]); const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::VectorImage<InputPixelType,Dimension> InputImageType; - typedef otb::VectorImage<OutputPixelType,Dimension> OutputImageType; - typedef otb::VectorRescaleIntensityImageFilter<InputImageType,OutputImageType> VectorRescaleIntensityImageFilterType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::MultiChannelExtractROI<OutputPixelType,OutputPixelType> SelectBandsFilterType; + typedef double InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; + typedef otb::VectorRescaleIntensityImageFilter<InputImageType, OutputImageType> VectorRescaleIntensityImageFilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::MultiChannelExtractROI<OutputPixelType, OutputPixelType> SelectBandsFilterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -47,7 +47,7 @@ int otbVectorRescaleIntensityImageFilter(int argc, char * argv[]) // Instantiating object VectorRescaleIntensityImageFilterType::Pointer filter = VectorRescaleIntensityImageFilterType::New(); filter->SetInput(reader->GetOutput()); - OutputImageType::PixelType minPixel,maxPixel; + OutputImageType::PixelType minPixel, maxPixel; minPixel.SetSize(reader->GetOutput()->GetNumberOfComponentsPerPixel()); maxPixel.SetSize(reader->GetOutput()->GetNumberOfComponentsPerPixel()); minPixel.Fill(min); @@ -56,7 +56,6 @@ int otbVectorRescaleIntensityImageFilter(int argc, char * argv[]) filter->SetOutputMaximum(maxPixel); filter->SetClampThreshold(0.01); - SelectBandsFilterType::Pointer selecter = SelectBandsFilterType::New(); selecter->SetInput(filter->GetOutput()); selecter->SetChannel(1); @@ -64,12 +63,10 @@ int otbVectorRescaleIntensityImageFilter(int argc, char * argv[]) selecter->SetChannel(3); selecter->SetExtractionRegion(reader->GetOutput()->GetLargestPossibleRegion()); - WriterType::Pointer writer = WriterType::New(); writer->SetInput(selecter->GetOutput()); writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilterNew.cxx b/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilterNew.cxx index defe77f116..3855fa7c70 100644 --- a/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilterNew.cxx +++ b/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilterNew.cxx @@ -23,15 +23,14 @@ int otbVectorRescaleIntensityImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::VectorImage<InputPixelType,Dimension> InputImageType; - typedef otb::VectorImage<OutputPixelType,Dimension> OutputImageType; - typedef otb::VectorRescaleIntensityImageFilter<InputImageType,OutputImageType> VectorRescaleIntensityImageFilterType; + typedef double InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; + typedef otb::VectorRescaleIntensityImageFilter<InputImageType, OutputImageType> VectorRescaleIntensityImageFilterType; // Instantiating object VectorRescaleIntensityImageFilterType::Pointer object = VectorRescaleIntensityImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunction.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunction.cxx index 46a40ff6df..82edccbbfa 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunction.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunction.cxx @@ -22,35 +22,33 @@ #include "otbImage.h" #include "otbImageFileReader.h" - int otbWindowedSincInterpolateImageBlackmanFunction(int argc, char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageBlackmanFunction<ImageType > InterpolatorType; - typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageBlackmanFunction<ImageType> InterpolatorType; + typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; // Instantiating objects InterpolatorType::Pointer interp = InterpolatorType::New(); unsigned int i = 4; - std::vector<ContinuousIndexType> indicesList; + std::vector<ContinuousIndexType> indicesList; - while (i<static_cast<unsigned int>(argc) && (i+1)<static_cast<unsigned int>(argc)) - { + while (i < static_cast<unsigned int>(argc) && (i + 1) < static_cast<unsigned int>(argc)) + { ContinuousIndexType idx1; - idx1[0]=atof(argv[i]); - idx1[1]=atof(argv[i+1]); + idx1[0] = atof(argv[i]); + idx1[1] = atof(argv[i + 1]); indicesList.push_back(idx1); - i+=2; - } - + i += 2; + } ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -62,15 +60,14 @@ int otbWindowedSincInterpolateImageBlackmanFunction(int argc, char * argv[]) std::ofstream file; file.open(outfname); - file << "Blackman Window Function"<<std::endl; - for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it) - { - file<<(*it)<<" -> "<<interp->EvaluateAtContinuousIndex((*it))<<std::endl; - } + file << "Blackman Window Function" << std::endl; + for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin(); it != indicesList.end(); ++it) + { + file << (*it) << " -> " << interp->EvaluateAtContinuousIndex((*it)) << std::endl; + } file << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunctionNew.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunctionNew.cxx index 80f8bd9654..f7ab261220 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunctionNew.cxx @@ -22,12 +22,11 @@ int otbWindowedSincInterpolateImageBlackmanFunctionNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageBlackmanFunction<ImageType> InterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageBlackmanFunction<ImageType> InterpolatorType; // Instantiating objects - InterpolatorType::Pointer interp = InterpolatorType::New(); - + InterpolatorType::Pointer interp = InterpolatorType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunction.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunction.cxx index 75a889e196..2da4110854 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunction.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunction.cxx @@ -22,35 +22,33 @@ #include "otbImage.h" #include "otbImageFileReader.h" - int otbWindowedSincInterpolateImageCosineFunction(int argc, char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageCosineFunction<ImageType > InterpolatorType; - typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageCosineFunction<ImageType> InterpolatorType; + typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; // Instantiating objects InterpolatorType::Pointer interp = InterpolatorType::New(); unsigned int i = 4; - std::vector<ContinuousIndexType> indicesList; + std::vector<ContinuousIndexType> indicesList; - while (i<static_cast<unsigned int>(argc) && (i+1)<static_cast<unsigned int>(argc)) - { + while (i < static_cast<unsigned int>(argc) && (i + 1) < static_cast<unsigned int>(argc)) + { ContinuousIndexType idx1; - idx1[0]=atof(argv[i]); - idx1[1]=atof(argv[i+1]); + idx1[0] = atof(argv[i]); + idx1[1] = atof(argv[i + 1]); indicesList.push_back(idx1); - i+=2; - } - + i += 2; + } ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -62,15 +60,14 @@ int otbWindowedSincInterpolateImageCosineFunction(int argc, char * argv[]) std::ofstream file; file.open(outfname); - file << "Cosine Window Function"<<std::endl; - for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it) - { - file<<(*it)<<" -> "<<interp->EvaluateAtContinuousIndex((*it))<<std::endl; - } + file << "Cosine Window Function" << std::endl; + for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin(); it != indicesList.end(); ++it) + { + file << (*it) << " -> " << interp->EvaluateAtContinuousIndex((*it)) << std::endl; + } file << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunctionNew.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunctionNew.cxx index d4092e3fd1..dcde2c0a3c 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunctionNew.cxx @@ -22,12 +22,11 @@ int otbWindowedSincInterpolateImageCosineFunctionNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageCosineFunction<ImageType> InterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageCosineFunction<ImageType> InterpolatorType; // Instantiating objects - InterpolatorType::Pointer interp = InterpolatorType::New(); - + InterpolatorType::Pointer interp = InterpolatorType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageFunctionBaseNew.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageFunctionBaseNew.cxx index 279e43a3be..feee469053 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageFunctionBaseNew.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageFunctionBaseNew.cxx @@ -21,22 +21,21 @@ #include "itkConstantBoundaryCondition.h" #include "otbImage.h" - namespace Function { -template< class TInput=double, class TOutput=double > +template<class TInput = double, class TOutput = double> class SameFunction { public: void SetRadius(unsigned int rad) { m_Radius = rad; - }; + } unsigned int GetRadius() const { return m_Radius; - }; - inline TOutput operator()( const TInput & A ) const + } + inline TOutput operator ()(const TInput& A) const { return static_cast<TOutput>(A); } @@ -47,9 +46,9 @@ public: int otbWindowedSincInterpolateImageFunctionBaseNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef Function::SameFunction<double,double> FunctionType; - typedef otb::WindowedSincInterpolateImageFunctionBase<ImageType, FunctionType> WindowedSincInterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef Function::SameFunction<double, double> FunctionType; + typedef otb::WindowedSincInterpolateImageFunctionBase<ImageType, FunctionType> WindowedSincInterpolatorType; // Instantiating object WindowedSincInterpolatorType::Pointer winInterp = WindowedSincInterpolatorType::New(); diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunction.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunction.cxx index e1cd252373..abbac7f3fb 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunction.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunction.cxx @@ -22,36 +22,34 @@ #include "otbImage.h" #include "otbImageFileReader.h" - int otbWindowedSincInterpolateImageGaussianFunction(int argc, char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<double,2> ImageType; + typedef otb::Image<double, 2> ImageType; // Gaussian - typedef otb::WindowedSincInterpolateImageGaussianFunction<ImageType> InterpolatorType; - typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; + typedef otb::WindowedSincInterpolateImageGaussianFunction<ImageType> InterpolatorType; + typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; // Instantiating objects InterpolatorType::Pointer interp = InterpolatorType::New(); unsigned int i = 4; - std::vector<ContinuousIndexType> indicesList; + std::vector<ContinuousIndexType> indicesList; - while (i<static_cast<unsigned int>(argc) && (i+1)<static_cast<unsigned int>(argc)) - { + while (i < static_cast<unsigned int>(argc) && (i + 1) < static_cast<unsigned int>(argc)) + { ContinuousIndexType idx1; - idx1[0]=atof(argv[i]); - idx1[1]=atof(argv[i+1]); + idx1[0] = atof(argv[i]); + idx1[1] = atof(argv[i + 1]); indicesList.push_back(idx1); - i+=2; - } - + i += 2; + } ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -63,15 +61,14 @@ int otbWindowedSincInterpolateImageGaussianFunction(int argc, char * argv[]) std::ofstream file; file.open(outfname); - file << "Gauss Window Function"<<std::endl; - for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it) - { - file<<(*it)<<" -> "<<interp->EvaluateAtContinuousIndex((*it))<<std::endl; - } + file << "Gauss Window Function" << std::endl; + for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin(); it != indicesList.end(); ++it) + { + file << (*it) << " -> " << interp->EvaluateAtContinuousIndex((*it)) << std::endl; + } file << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunctionNew.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunctionNew.cxx index 9d5c07428f..7988bcdf8f 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunctionNew.cxx @@ -22,12 +22,11 @@ int otbWindowedSincInterpolateImageGaussianFunctionNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageGaussianFunction<ImageType> InterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageGaussianFunction<ImageType> InterpolatorType; // Instantiating objects - InterpolatorType::Pointer interp = InterpolatorType::New(); - + InterpolatorType::Pointer interp = InterpolatorType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunction.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunction.cxx index 4b14e934a6..787fea71b9 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunction.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunction.cxx @@ -22,35 +22,33 @@ #include "otbImage.h" #include "otbImageFileReader.h" - int otbWindowedSincInterpolateImageHammingFunction(int argc, char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageHammingFunction<ImageType> InterpolatorType; - typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageHammingFunction<ImageType> InterpolatorType; + typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; // Instantiating objects InterpolatorType::Pointer interp = InterpolatorType::New(); unsigned int i = 4; - std::vector<ContinuousIndexType> indicesList; + std::vector<ContinuousIndexType> indicesList; - while (i<static_cast<unsigned int>(argc) && (i+1)<static_cast<unsigned int>(argc)) - { + while (i < static_cast<unsigned int>(argc) && (i + 1) < static_cast<unsigned int>(argc)) + { ContinuousIndexType idx1; - idx1[0]=atof(argv[i]); - idx1[1]=atof(argv[i+1]); + idx1[0] = atof(argv[i]); + idx1[1] = atof(argv[i + 1]); indicesList.push_back(idx1); - i+=2; - } - + i += 2; + } ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -62,15 +60,14 @@ int otbWindowedSincInterpolateImageHammingFunction(int argc, char * argv[]) std::ofstream file; file.open(outfname); - file << "Hamming Window Function"<<std::endl; - for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it) - { - file<<(*it)<<" -> "<<interp->EvaluateAtContinuousIndex((*it))<<std::endl; - } + file << "Hamming Window Function" << std::endl; + for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin(); it != indicesList.end(); ++it) + { + file << (*it) << " -> " << interp->EvaluateAtContinuousIndex((*it)) << std::endl; + } file << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunctionNew.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunctionNew.cxx index afaedb8578..69be5375ab 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunctionNew.cxx @@ -22,12 +22,11 @@ int otbWindowedSincInterpolateImageHammingFunctionNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageHammingFunction<ImageType> InterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageHammingFunction<ImageType> InterpolatorType; // Instantiating objects - InterpolatorType::Pointer interp = InterpolatorType::New(); - + InterpolatorType::Pointer interp = InterpolatorType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunction.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunction.cxx index 97fca874d2..7103b9cba7 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunction.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunction.cxx @@ -22,35 +22,33 @@ #include "otbImage.h" #include "otbImageFileReader.h" - int otbWindowedSincInterpolateImageLanczosFunction(int argc, char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageLanczosFunction<ImageType > InterpolatorType; - typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageLanczosFunction<ImageType> InterpolatorType; + typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; // Instantiating objects InterpolatorType::Pointer interp = InterpolatorType::New(); unsigned int i = 4; - std::vector<ContinuousIndexType> indicesList; + std::vector<ContinuousIndexType> indicesList; - while (i<static_cast<unsigned int>(argc) && (i+1)<static_cast<unsigned int>(argc)) - { + while (i < static_cast<unsigned int>(argc) && (i + 1) < static_cast<unsigned int>(argc)) + { ContinuousIndexType idx1; - idx1[0]=atof(argv[i]); - idx1[1]=atof(argv[i+1]); + idx1[0] = atof(argv[i]); + idx1[1] = atof(argv[i + 1]); indicesList.push_back(idx1); - i+=2; - } - + i += 2; + } ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -62,15 +60,14 @@ int otbWindowedSincInterpolateImageLanczosFunction(int argc, char * argv[]) std::ofstream file; file.open(outfname); - file << "Lanczos Window Function"<<std::endl; - for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it) - { - file<<(*it)<<" -> "<<interp->EvaluateAtContinuousIndex((*it))<<std::endl; - } + file << "Lanczos Window Function" << std::endl; + for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin(); it != indicesList.end(); ++it) + { + file << (*it) << " -> " << interp->EvaluateAtContinuousIndex((*it)) << std::endl; + } file << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunctionNew.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunctionNew.cxx index d3a82c752e..5bb7adbad0 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunctionNew.cxx @@ -22,12 +22,11 @@ int otbWindowedSincInterpolateImageLanczosFunctionNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageLanczosFunction<ImageType> InterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageLanczosFunction<ImageType> InterpolatorType; // Instantiating objects - InterpolatorType::Pointer interp = InterpolatorType::New(); - + InterpolatorType::Pointer interp = InterpolatorType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunction.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunction.cxx index 8ef0141194..50a7339ac4 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunction.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunction.cxx @@ -22,35 +22,33 @@ #include "otbImage.h" #include "otbImageFileReader.h" - int otbWindowedSincInterpolateImageWelchFunction(int argc, char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageWelchFunction<ImageType > InterpolatorType; - typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageWelchFunction<ImageType> InterpolatorType; + typedef InterpolatorType::ContinuousIndexType ContinuousIndexType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; // Instantiating objects InterpolatorType::Pointer interp = InterpolatorType::New(); unsigned int i = 4; - std::vector<ContinuousIndexType> indicesList; + std::vector<ContinuousIndexType> indicesList; - while (i<static_cast<unsigned int>(argc) && (i+1)<static_cast<unsigned int>(argc)) - { + while (i < static_cast<unsigned int>(argc) && (i + 1) < static_cast<unsigned int>(argc)) + { ContinuousIndexType idx1; - idx1[0]=atof(argv[i]); - idx1[1]=atof(argv[i+1]); + idx1[0] = atof(argv[i]); + idx1[1] = atof(argv[i + 1]); indicesList.push_back(idx1); - i+=2; - } - + i += 2; + } ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -62,15 +60,14 @@ int otbWindowedSincInterpolateImageWelchFunction(int argc, char * argv[]) std::ofstream file; file.open(outfname); - file << "Welch Window Function"<<std::endl; - for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it) - { - file<<(*it)<<" -> "<<interp->EvaluateAtContinuousIndex((*it))<<std::endl; - } + file << "Welch Window Function" << std::endl; + for (std::vector<ContinuousIndexType>::iterator it = indicesList.begin(); it != indicesList.end(); ++it) + { + file << (*it) << " -> " << interp->EvaluateAtContinuousIndex((*it)) << std::endl; + } file << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunctionNew.cxx b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunctionNew.cxx index a360f31221..bc26683c0e 100644 --- a/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunctionNew.cxx +++ b/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunctionNew.cxx @@ -22,12 +22,11 @@ int otbWindowedSincInterpolateImageWelchFunctionNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::WindowedSincInterpolateImageWelchFunction<ImageType> InterpolatorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::WindowedSincInterpolateImageWelchFunction<ImageType> InterpolatorType; // Instantiating objects - InterpolatorType::Pointer interp = InterpolatorType::New(); - + InterpolatorType::Pointer interp = InterpolatorType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/ChangeDetection/otbCBAMIChangeDetectionTest.cxx b/Testing/Code/ChangeDetection/otbCBAMIChangeDetectionTest.cxx index 2d212204f7..89141a8765 100644 --- a/Testing/Code/ChangeDetection/otbCBAMIChangeDetectionTest.cxx +++ b/Testing/Code/ChangeDetection/otbCBAMIChangeDetectionTest.cxx @@ -23,45 +23,42 @@ #include "otbCBAMIChangeDetector.h" #include "otbCommandProgressUpdate.h" - -int otbCBAMIChangeDetectionTest(int argc, char* argv[] ) +int otbCBAMIChangeDetectionTest(int argc, char* argv[]) { - if ( argc < 5 ) - { + if (argc < 5) + { std::cerr << "Usage: " << std::endl; std::cerr << argv[0] << " inputImageFile1 inputImageFile2 radius outputImageFile " << std::endl; return -1; - } + } // Define the dimension of the images const unsigned int Dimension = 2; // Declare the types of the images - typedef double InternalPixelType; - typedef unsigned char OutputPixelType; - typedef itk::Image<InternalPixelType, Dimension> InputImageType1; - typedef itk::Image<InternalPixelType, Dimension> InputImageType2; - typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; - typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - - typedef itk::ImageFileReader< InputImageType1 > ReaderType1; - typedef itk::ImageFileReader< InputImageType2 > ReaderType2; - typedef itk::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter< ChangeImageType, - OutputImageType > RescalerType; - + typedef double InternalPixelType; + typedef unsigned char OutputPixelType; + typedef itk::Image<InternalPixelType, Dimension> InputImageType1; + typedef itk::Image<InternalPixelType, Dimension> InputImageType2; + typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + + typedef itk::ImageFileReader<InputImageType1> ReaderType1; + typedef itk::ImageFileReader<InputImageType2> ReaderType2; + typedef itk::ImageFileWriter<OutputImageType> WriterType; + typedef itk::RescaleIntensityImageFilter<ChangeImageType, + OutputImageType> RescalerType; // Declare the type for the filter typedef otb::CBAMIChangeDetector< - InputImageType1, - InputImageType2, - ChangeImageType > FilterType; - + InputImageType1, + InputImageType2, + ChangeImageType> FilterType; - ReaderType1::Pointer reader1 = ReaderType1::New(); - ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); + WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); RescalerType::Pointer rescaler = RescalerType::New(); @@ -69,28 +66,25 @@ int otbCBAMIChangeDetectionTest(int argc, char* argv[] ) const char * inputFilename2 = argv[2]; const char * outputFilename = argv[4]; - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); - rescaler->SetOutputMinimum( itk::NumericTraits< OutputPixelType >::min()); - rescaler->SetOutputMaximum( itk::NumericTraits< OutputPixelType >::max()); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); + rescaler->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min()); + rescaler->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max()); - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); - filter->SetRadius( atoi(argv[3]) ); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + filter->SetRadius(atoi(argv[3])); - rescaler->SetInput( filter->GetOutput() ); - writer->SetInput( rescaler->GetOutput() ); + rescaler->SetInput(filter->GetOutput()); + writer->SetInput(rescaler->GetOutput()); typedef otb::CommandProgressUpdate<FilterType> CommandType; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); - writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/ChangeDetection/otbChangeDetectionTests1.cxx b/Testing/Code/ChangeDetection/otbChangeDetectionTests1.cxx index 39c0105090..11c241e4b5 100644 --- a/Testing/Code/ChangeDetection/otbChangeDetectionTests1.cxx +++ b/Testing/Code/ChangeDetection/otbChangeDetectionTests1.cxx @@ -26,10 +26,10 @@ void RegisterTests() { - REGISTER_TEST(otbCBAMIChangeDetectionTest ); - REGISTER_TEST(otbCorrelChangeDetectionTest ); - REGISTER_TEST(otbMeanDiffChangeDetectionTest ); - REGISTER_TEST(otbMeanRatioChangeDetectionTest ); - REGISTER_TEST(otbLHMIChangeDetectionTest ); - REGISTER_TEST(otbJHMIChangeDetectionTest ); + REGISTER_TEST(otbCBAMIChangeDetectionTest); + REGISTER_TEST(otbCorrelChangeDetectionTest); + REGISTER_TEST(otbMeanDiffChangeDetectionTest); + REGISTER_TEST(otbMeanRatioChangeDetectionTest); + REGISTER_TEST(otbLHMIChangeDetectionTest); + REGISTER_TEST(otbJHMIChangeDetectionTest); } diff --git a/Testing/Code/ChangeDetection/otbCorrelChangeDetectionTest.cxx b/Testing/Code/ChangeDetection/otbCorrelChangeDetectionTest.cxx index c17339e178..15cd145979 100644 --- a/Testing/Code/ChangeDetection/otbCorrelChangeDetectionTest.cxx +++ b/Testing/Code/ChangeDetection/otbCorrelChangeDetectionTest.cxx @@ -23,45 +23,42 @@ #include "otbCorrelationChangeDetector.h" #include "otbCommandProgressUpdate.h" - -int otbCorrelChangeDetectionTest(int argc, char* argv[] ) +int otbCorrelChangeDetectionTest(int argc, char* argv[]) { - if ( argc < 5 ) - { + if (argc < 5) + { std::cerr << "Usage: " << std::endl; std::cerr << argv[0] << " inputImageFile1 inputImageFile2 radius outputImageFile " << std::endl; return -1; - } + } // Define the dimension of the images const unsigned int Dimension = 2; // Declare the types of the images - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; - typedef itk::Image<InternalPixelType, Dimension> InputImageType1; - typedef itk::Image<InternalPixelType, Dimension> InputImageType2; - typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; - typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - - typedef itk::ImageFileReader< InputImageType1 > ReaderType1; - typedef itk::ImageFileReader< InputImageType2 > ReaderType2; - typedef itk::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter< ChangeImageType, - OutputImageType > RescalerType; - + typedef float InternalPixelType; + typedef unsigned char OutputPixelType; + typedef itk::Image<InternalPixelType, Dimension> InputImageType1; + typedef itk::Image<InternalPixelType, Dimension> InputImageType2; + typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + + typedef itk::ImageFileReader<InputImageType1> ReaderType1; + typedef itk::ImageFileReader<InputImageType2> ReaderType2; + typedef itk::ImageFileWriter<OutputImageType> WriterType; + typedef itk::RescaleIntensityImageFilter<ChangeImageType, + OutputImageType> RescalerType; // Declare the type for the filter typedef otb::CorrelationChangeDetector< - InputImageType1, - InputImageType2, - ChangeImageType > FilterType; + InputImageType1, + InputImageType2, + ChangeImageType> FilterType; - - ReaderType1::Pointer reader1 = ReaderType1::New(); - ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); + WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); RescalerType::Pointer rescaler = RescalerType::New(); @@ -69,30 +66,25 @@ int otbCorrelChangeDetectionTest(int argc, char* argv[] ) const char * inputFilename2 = argv[2]; const char * outputFilename = argv[4]; - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); - rescaler->SetOutputMinimum( itk::NumericTraits< OutputPixelType >::min()); - rescaler->SetOutputMaximum( itk::NumericTraits< OutputPixelType >::max()); - - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); - filter->SetRadius( atoi(argv[3]) ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); + rescaler->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min()); + rescaler->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max()); - rescaler->SetInput( filter->GetOutput() ); - writer->SetInput( rescaler->GetOutput() ); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + filter->SetRadius(atoi(argv[3])); + rescaler->SetInput(filter->GetOutput()); + writer->SetInput(rescaler->GetOutput()); typedef otb::CommandProgressUpdate<FilterType> CommandType; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); - writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/ChangeDetection/otbJHMIChangeDetectionTest.cxx b/Testing/Code/ChangeDetection/otbJHMIChangeDetectionTest.cxx index df7eb7134d..e35b9eb3dd 100644 --- a/Testing/Code/ChangeDetection/otbJHMIChangeDetectionTest.cxx +++ b/Testing/Code/ChangeDetection/otbJHMIChangeDetectionTest.cxx @@ -23,44 +23,42 @@ #include "otbJoinHistogramMIImageFilter.h" #include "otbCommandProgressUpdate.h" -int otbJHMIChangeDetectionTest(int argc, char* argv[] ) +int otbJHMIChangeDetectionTest(int argc, char* argv[]) { - if ( argc < 5 ) - { + if (argc < 5) + { std::cerr << "Usage: " << std::endl; std::cerr << argv[0] << " inputImageFile1 inputImageFile2 radius outputImageFile " << std::endl; return -1; - } + } // Define the dimension of the images const unsigned int Dimension = 2; // Declare the types of the images - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; - typedef itk::Image<InternalPixelType, Dimension> InputImageType1; - typedef itk::Image<InternalPixelType, Dimension> InputImageType2; - typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; - typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - - typedef itk::ImageFileReader< InputImageType1 > ReaderType1; - typedef itk::ImageFileReader< InputImageType2 > ReaderType2; - typedef itk::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter< ChangeImageType, - OutputImageType > RescalerType; - + typedef float InternalPixelType; + typedef unsigned char OutputPixelType; + typedef itk::Image<InternalPixelType, Dimension> InputImageType1; + typedef itk::Image<InternalPixelType, Dimension> InputImageType2; + typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + + typedef itk::ImageFileReader<InputImageType1> ReaderType1; + typedef itk::ImageFileReader<InputImageType2> ReaderType2; + typedef itk::ImageFileWriter<OutputImageType> WriterType; + typedef itk::RescaleIntensityImageFilter<ChangeImageType, + OutputImageType> RescalerType; // Declare the type for the filter typedef otb::JoinHistogramMIImageFilter< - InputImageType1, - InputImageType2, - ChangeImageType > FilterType; + InputImageType1, + InputImageType2, + ChangeImageType> FilterType; - - ReaderType1::Pointer reader1 = ReaderType1::New(); - ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); + WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); RescalerType::Pointer rescaler = RescalerType::New(); @@ -68,31 +66,26 @@ int otbJHMIChangeDetectionTest(int argc, char* argv[] ) const char * inputFilename2 = argv[2]; const char * outputFilename = argv[4]; - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); - rescaler->SetOutputMinimum( itk::NumericTraits< OutputPixelType >::min()); - rescaler->SetOutputMaximum( itk::NumericTraits< OutputPixelType >::max()); - - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); - filter->SetRadius( atoi(argv[3]) ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); + rescaler->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min()); + rescaler->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max()); - rescaler->SetInput( filter->GetOutput() ); - writer->SetInput( rescaler->GetOutput() ); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + filter->SetRadius(atoi(argv[3])); + rescaler->SetInput(filter->GetOutput()); + writer->SetInput(rescaler->GetOutput()); typedef otb::CommandProgressUpdate<FilterType> CommandType; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); - writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilter.cxx b/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilter.cxx index cf09721e65..bb7747a730 100644 --- a/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilter.cxx +++ b/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilter.cxx @@ -21,46 +21,44 @@ #include "otbImageFileWriter.h" #include "otbKullbackLeiblerDistanceImageFilter.h" - int otbKullbackLeiblerDistanceImageFilter(int argc, char * argv[]) { if (argc != 5) - { - std::cerr<<"Detection de changements par mesure de Kullback-Leibler, optimisee par un developpement de Edgeworth\n"; + { + std::cerr << + "Detection de changements par mesure de Kullback-Leibler, optimisee par un developpement de Edgeworth\n"; std::cerr << argv[0] << " imgAv imgAp imgResu winSize\n"; return 1; - } + } char * fileName1 = argv[1]; char * fileName2 = argv[2]; char * fileNameOut = argv[3]; - int winSize = atoi(argv[4]); - + int winSize = atoi(argv[4]); const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::KullbackLeiblerDistanceImageFilter<ImageType,ImageType,ImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::KullbackLeiblerDistanceImageFilter<ImageType, ImageType, ImageType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; ReaderType::Pointer reader1 = ReaderType::New(); - reader1->SetFileName( fileName1 ); + reader1->SetFileName(fileName1); ReaderType::Pointer reader2 = ReaderType::New(); - reader2->SetFileName( fileName2 ); + reader2->SetFileName(fileName2); FilterType::Pointer filter = FilterType::New(); - filter->SetRadius( (winSize-1)/2 ); - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); + filter->SetRadius((winSize - 1) / 2); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); WriterType::Pointer writer = WriterType::New(); writer->SetFileName(fileNameOut); writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilterNew.cxx b/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilterNew.cxx index 3d8c2ecd40..ecdfe1e43f 100644 --- a/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilterNew.cxx +++ b/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilterNew.cxx @@ -19,17 +19,15 @@ #include "otbImage.h" #include "otbKullbackLeiblerDistanceImageFilter.h" - int otbKullbackLeiblerDistanceImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::KullbackLeiblerDistanceImageFilter<ImageType,ImageType,ImageType> FilterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::KullbackLeiblerDistanceImageFilter<ImageType, ImageType, ImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilter.cxx b/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilter.cxx index fd324951d5..32fd426d63 100644 --- a/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilter.cxx +++ b/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilter.cxx @@ -22,47 +22,46 @@ #include "otbImageFileWriter.h" #include "otbKullbackLeiblerProfileImageFilter.h" - int otbKullbackLeiblerProfileImageFilter(int argc, char * argv[]) { if (argc != 6) - { - std::cerr<<"Detection de changements par mesure de Kullback-Leibler, optimisee par un developpement de Edgeworth\n"; + { + std::cerr << + "Detection de changements par mesure de Kullback-Leibler, optimisee par un developpement de Edgeworth\n"; std::cerr << argv[0] << " imgAv imgAp imgResu winSizeMin winSizeMax\n"; return 1; - } + } char * fileName1 = argv[1]; char * fileName2 = argv[2]; char * fileNameOut = argv[3]; - int winSizeMin = atoi(argv[4]); - int winSizeMax = atoi(argv[5]); + int winSizeMin = atoi(argv[4]); + int winSizeMax = atoi(argv[5]); const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::KullbackLeiblerProfileImageFilter<ImageType,ImageType,VectorImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::KullbackLeiblerProfileImageFilter<ImageType, ImageType, VectorImageType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<VectorImageType> WriterType; ReaderType::Pointer reader1 = ReaderType::New(); - reader1->SetFileName( fileName1 ); + reader1->SetFileName(fileName1); ReaderType::Pointer reader2 = ReaderType::New(); - reader2->SetFileName( fileName2 ); + reader2->SetFileName(fileName2); FilterType::Pointer filter = FilterType::New(); - filter->SetRadius( (winSizeMin-1)/2,(winSizeMax-1)/2 ); - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); + filter->SetRadius((winSizeMin - 1) / 2, (winSizeMax - 1) / 2); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); WriterType::Pointer writer = WriterType::New(); writer->SetFileName(fileNameOut); writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilterNew.cxx b/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilterNew.cxx index 94fe0e0320..f9ffd42a84 100644 --- a/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilterNew.cxx +++ b/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilterNew.cxx @@ -25,12 +25,11 @@ int otbKullbackLeiblerProfileImageFilterNew(int argc, char * argv[]) const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::KullbackLeiblerProfileImageFilter<ImageType,ImageType,VectorImageType> FilterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::KullbackLeiblerProfileImageFilter<ImageType, ImageType, VectorImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilter.cxx b/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilter.cxx index 55f5d83487..340d0def5c 100644 --- a/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilter.cxx +++ b/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilter.cxx @@ -25,79 +25,78 @@ int otbKullbackLeiblerSupervizedDistanceImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef unsigned char TrainingPixelType; + typedef double InputPixelType; + typedef unsigned char TrainingPixelType; - typedef otb::Image< InputPixelType, Dimension > ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; + typedef otb::Image<InputPixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::Image< TrainingPixelType, Dimension > TrainingImageType; - typedef otb::ImageFileReader< TrainingImageType > TrainingReaderType; + typedef otb::Image<TrainingPixelType, Dimension> TrainingImageType; + typedef otb::ImageFileReader<TrainingImageType> TrainingReaderType; - if(argc !=6) + if (argc != 6) { - std::cout << "Invalid number of arguiments !!"<<std::endl; - return EXIT_FAILURE; + std::cout << "Invalid number of arguiments !!" << std::endl; + return EXIT_FAILURE; } - const char * inputImageFileName1 = argv[1]; - const char * inputImageFileName2 = argv[2]; - const char * inputTrainingImageFileName = argv[3]; - const int winSize(atoi(argv[4])); - const char * outputImageFileName = argv[5]; - - - ImageType::Pointer img1 = ImageType::New(); - ReaderType::Pointer reader1 = ReaderType::New(); - reader1->SetFileName( inputImageFileName1 ); - //reader1->Update(); - img1 = reader1->GetOutput(); - - ImageType::Pointer img2 = ImageType::New(); - ReaderType::Pointer reader2 = ReaderType::New(); - reader2->SetFileName( inputImageFileName2 ); - //reader2->Update(); - img2 = reader2->GetOutput(); - - TrainingImageType::Pointer imgRoi = TrainingImageType::New(); - TrainingReaderType::Pointer readerRoi = TrainingReaderType::New(); - readerRoi->SetFileName( inputTrainingImageFileName ); - //readerRoi->Update(); - imgRoi = readerRoi->GetOutput(); - - typedef otb::KullbackLeiblerSupervizedDistanceImageFilter< - ImageType, ImageType, TrainingImageType, ImageType > FilterType; - - FilterType::Pointer changeDetector = FilterType::New(); - changeDetector->SetRadius( (winSize-1)/2 ); - changeDetector->SetInput1( img1 ); - changeDetector->SetInput2( img2 ); - - // Once img1 and img2 are connected, it is time to connect imgRoi - // to perform the parameters estimation of the non-changed area. - - changeDetector->SetTrainingArea( imgRoi ); - - typedef otb::CommandProgressUpdate< FilterType > CommandType; - CommandType::Pointer observer = CommandType::New(); - changeDetector->AddObserver( itk::ProgressEvent(), observer ); - - typedef unsigned char OutputPixelType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef itk::RescaleIntensityImageFilter< ImageType, OutputImageType > - RescalerType; - RescalerType::Pointer rescaler = RescalerType::New(); - rescaler->SetOutputMinimum(0); - rescaler->SetOutputMaximum(255); - rescaler->SetInput( changeDetector->GetOutput() ); - - typedef otb::ImageFileWriter< OutputImageType > WriterType; - WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputImageFileName ); - writer->SetInput( rescaler->GetOutput() ); - - writer->Update(); - - return EXIT_SUCCESS; + const char * inputImageFileName1 = argv[1]; + const char * inputImageFileName2 = argv[2]; + const char * inputTrainingImageFileName = argv[3]; + const int winSize(atoi(argv[4])); + const char * outputImageFileName = argv[5]; + + ImageType::Pointer img1 = ImageType::New(); + ReaderType::Pointer reader1 = ReaderType::New(); + reader1->SetFileName(inputImageFileName1); + //reader1->Update(); + img1 = reader1->GetOutput(); + + ImageType::Pointer img2 = ImageType::New(); + ReaderType::Pointer reader2 = ReaderType::New(); + reader2->SetFileName(inputImageFileName2); + //reader2->Update(); + img2 = reader2->GetOutput(); + + TrainingImageType::Pointer imgRoi = TrainingImageType::New(); + TrainingReaderType::Pointer readerRoi = TrainingReaderType::New(); + readerRoi->SetFileName(inputTrainingImageFileName); + //readerRoi->Update(); + imgRoi = readerRoi->GetOutput(); + + typedef otb::KullbackLeiblerSupervizedDistanceImageFilter< + ImageType, ImageType, TrainingImageType, ImageType> FilterType; + + FilterType::Pointer changeDetector = FilterType::New(); + changeDetector->SetRadius((winSize - 1) / 2); + changeDetector->SetInput1(img1); + changeDetector->SetInput2(img2); + + // Once img1 and img2 are connected, it is time to connect imgRoi + // to perform the parameters estimation of the non-changed area. + + changeDetector->SetTrainingArea(imgRoi); + + typedef otb::CommandProgressUpdate<FilterType> CommandType; + CommandType::Pointer observer = CommandType::New(); + changeDetector->AddObserver(itk::ProgressEvent(), observer); + + typedef unsigned char OutputPixelType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> + RescalerType; + RescalerType::Pointer rescaler = RescalerType::New(); + rescaler->SetOutputMinimum(0); + rescaler->SetOutputMaximum(255); + rescaler->SetInput(changeDetector->GetOutput()); + + typedef otb::ImageFileWriter<OutputImageType> WriterType; + WriterType::Pointer writer = WriterType::New(); + writer->SetFileName(outputImageFileName); + writer->SetInput(rescaler->GetOutput()); + + writer->Update(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilterNew.cxx b/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilterNew.cxx index 5dd2b53aa0..b964086939 100644 --- a/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilterNew.cxx +++ b/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilterNew.cxx @@ -19,16 +19,18 @@ #include "otbImage.h" #include "otbKullbackLeiblerSupervizedDistanceImageFilter.h" - int otbKullbackLeiblerSupervizedDistanceImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; + typedef double PixelType; typedef unsigned char TrainingPixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::Image< TrainingPixelType, Dimension > TrainingImageType; - typedef otb::KullbackLeiblerSupervizedDistanceImageFilter<ImageType,ImageType,TrainingImageType,ImageType> FilterType; + typedef otb::Image<PixelType, + Dimension> ImageType; + typedef otb::Image<TrainingPixelType, + Dimension> TrainingImageType; + typedef otb::KullbackLeiblerSupervizedDistanceImageFilter<ImageType, ImageType, TrainingImageType, + ImageType> FilterType; FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/ChangeDetection/otbLHMIChangeDetectionTest.cxx b/Testing/Code/ChangeDetection/otbLHMIChangeDetectionTest.cxx index 5428744a1a..953d13b822 100644 --- a/Testing/Code/ChangeDetection/otbLHMIChangeDetectionTest.cxx +++ b/Testing/Code/ChangeDetection/otbLHMIChangeDetectionTest.cxx @@ -23,45 +23,42 @@ #include "otbLHMIChangeDetector.h" #include "otbCommandProgressUpdate.h" - -int otbLHMIChangeDetectionTest(int argc, char* argv[] ) +int otbLHMIChangeDetectionTest(int argc, char* argv[]) { - if ( argc < 5 ) - { + if (argc < 5) + { std::cerr << "Usage: " << std::endl; std::cerr << argv[0] << " inputImageFile1 inputImageFile2 radius outputImageFile " << std::endl; return -1; - } + } // Define the dimension of the images const unsigned int Dimension = 2; // Declare the types of the images - typedef double InternalPixelType; - typedef unsigned char OutputPixelType; - typedef itk::Image<InternalPixelType, Dimension> InputImageType1; - typedef itk::Image<InternalPixelType, Dimension> InputImageType2; - typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; - typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - - typedef itk::ImageFileReader< InputImageType1 > ReaderType1; - typedef itk::ImageFileReader< InputImageType2 > ReaderType2; - typedef itk::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter< ChangeImageType, - OutputImageType > RescalerType; - + typedef double InternalPixelType; + typedef unsigned char OutputPixelType; + typedef itk::Image<InternalPixelType, Dimension> InputImageType1; + typedef itk::Image<InternalPixelType, Dimension> InputImageType2; + typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + + typedef itk::ImageFileReader<InputImageType1> ReaderType1; + typedef itk::ImageFileReader<InputImageType2> ReaderType2; + typedef itk::ImageFileWriter<OutputImageType> WriterType; + typedef itk::RescaleIntensityImageFilter<ChangeImageType, + OutputImageType> RescalerType; // Declare the type for the filter typedef otb::LHMIChangeDetector< - InputImageType1, - InputImageType2, - ChangeImageType > FilterType; - + InputImageType1, + InputImageType2, + ChangeImageType> FilterType; - ReaderType1::Pointer reader1 = ReaderType1::New(); - ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); + WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); RescalerType::Pointer rescaler = RescalerType::New(); @@ -69,29 +66,25 @@ int otbLHMIChangeDetectionTest(int argc, char* argv[] ) const char * inputFilename2 = argv[2]; const char * outputFilename = argv[4]; - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); - rescaler->SetOutputMinimum( itk::NumericTraits< OutputPixelType >::min()); - rescaler->SetOutputMaximum( itk::NumericTraits< OutputPixelType >::max()); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); + rescaler->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min()); + rescaler->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max()); - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); - filter->SetRadius( atoi(argv[3]) ); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + filter->SetRadius(atoi(argv[3])); - rescaler->SetInput( filter->GetOutput() ); - writer->SetInput( rescaler->GetOutput() ); + rescaler->SetInput(filter->GetOutput()); + writer->SetInput(rescaler->GetOutput()); typedef otb::CommandProgressUpdate<FilterType> CommandType; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); - writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/ChangeDetection/otbMeanDiffChangeDetectionTest.cxx b/Testing/Code/ChangeDetection/otbMeanDiffChangeDetectionTest.cxx index 4e36551309..6bd707ab3c 100644 --- a/Testing/Code/ChangeDetection/otbMeanDiffChangeDetectionTest.cxx +++ b/Testing/Code/ChangeDetection/otbMeanDiffChangeDetectionTest.cxx @@ -23,44 +23,42 @@ #include "otbMeanDifferenceImageFilter.h" #include "otbCommandProgressUpdate.h" -int otbMeanDiffChangeDetectionTest(int argc, char* argv[] ) +int otbMeanDiffChangeDetectionTest(int argc, char* argv[]) { - if ( argc < 5 ) - { + if (argc < 5) + { std::cerr << "Usage: " << std::endl; std::cerr << argv[0] << " inputImageFile1 inputImageFile2 radius outputImageFile " << std::endl; return -1; - } + } // Define the dimension of the images const unsigned int Dimension = 2; // Declare the types of the images - typedef double InternalPixelType; - typedef double OutputPixelType; - typedef otb::Image<InternalPixelType, Dimension> InputImageType1; - typedef otb::Image<InternalPixelType, Dimension> InputImageType2; - typedef otb::Image<InternalPixelType, Dimension> ChangeImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - - typedef otb::ImageFileReader< InputImageType1 > ReaderType1; - typedef otb::ImageFileReader< InputImageType2 > ReaderType2; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter< ChangeImageType, - OutputImageType > RescalerType; - + typedef double InternalPixelType; + typedef double OutputPixelType; + typedef otb::Image<InternalPixelType, Dimension> InputImageType1; + typedef otb::Image<InternalPixelType, Dimension> InputImageType2; + typedef otb::Image<InternalPixelType, Dimension> ChangeImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + + typedef otb::ImageFileReader<InputImageType1> ReaderType1; + typedef otb::ImageFileReader<InputImageType2> ReaderType2; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef itk::RescaleIntensityImageFilter<ChangeImageType, + OutputImageType> RescalerType; // Declare the type for the filter typedef otb::MeanDifferenceImageFilter< - InputImageType1, - InputImageType2, - ChangeImageType > FilterType; + InputImageType1, + InputImageType2, + ChangeImageType> FilterType; - - ReaderType1::Pointer reader1 = ReaderType1::New(); - ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); + WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); RescalerType::Pointer rescaler = RescalerType::New(); @@ -68,31 +66,26 @@ int otbMeanDiffChangeDetectionTest(int argc, char* argv[] ) const char * inputFilename2 = argv[2]; const char * outputFilename = argv[4]; - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); - rescaler->SetOutputMinimum( -1 ); - rescaler->SetOutputMaximum( 1 ); - - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); - filter->SetRadius( atoi(argv[3]) ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); + rescaler->SetOutputMinimum(-1); + rescaler->SetOutputMaximum(1); - rescaler->SetInput( filter->GetOutput() ); - writer->SetInput( rescaler->GetOutput() ); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + filter->SetRadius(atoi(argv[3])); + rescaler->SetInput(filter->GetOutput()); + writer->SetInput(rescaler->GetOutput()); typedef otb::CommandProgressUpdate<FilterType> CommandType; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); - writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/ChangeDetection/otbMeanRatioChangeDetectionTest.cxx b/Testing/Code/ChangeDetection/otbMeanRatioChangeDetectionTest.cxx index 58323e2d15..e37cc0668c 100644 --- a/Testing/Code/ChangeDetection/otbMeanRatioChangeDetectionTest.cxx +++ b/Testing/Code/ChangeDetection/otbMeanRatioChangeDetectionTest.cxx @@ -23,44 +23,42 @@ #include "otbMeanRatioImageFilter.h" #include "otbCommandProgressUpdate.h" -int otbMeanRatioChangeDetectionTest (int argc, char* argv[] ) +int otbMeanRatioChangeDetectionTest(int argc, char* argv[]) { - if ( argc < 5 ) - { + if (argc < 5) + { std::cerr << "Usage: " << std::endl; std::cerr << argv[0] << " inputImageFile1 inputImageFile2 radius outputImageFile " << std::endl; return -1; - } + } // Define the dimension of the images const unsigned int Dimension = 2; // Declare the types of the images - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; - typedef itk::Image<InternalPixelType, Dimension> InputImageType1; - typedef itk::Image<InternalPixelType, Dimension> InputImageType2; - typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; - typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - - typedef itk::ImageFileReader< InputImageType1 > ReaderType1; - typedef itk::ImageFileReader< InputImageType2 > ReaderType2; - typedef itk::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter< ChangeImageType, - OutputImageType > RescalerType; - + typedef float InternalPixelType; + typedef unsigned char OutputPixelType; + typedef itk::Image<InternalPixelType, Dimension> InputImageType1; + typedef itk::Image<InternalPixelType, Dimension> InputImageType2; + typedef itk::Image<InternalPixelType, Dimension> ChangeImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + + typedef itk::ImageFileReader<InputImageType1> ReaderType1; + typedef itk::ImageFileReader<InputImageType2> ReaderType2; + typedef itk::ImageFileWriter<OutputImageType> WriterType; + typedef itk::RescaleIntensityImageFilter<ChangeImageType, + OutputImageType> RescalerType; // Declare the type for the filter typedef otb::MeanRatioImageFilter< - InputImageType1, - InputImageType2, - ChangeImageType > FilterType; + InputImageType1, + InputImageType2, + ChangeImageType> FilterType; - - ReaderType1::Pointer reader1 = ReaderType1::New(); - ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); + WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); RescalerType::Pointer rescaler = RescalerType::New(); @@ -68,31 +66,26 @@ int otbMeanRatioChangeDetectionTest (int argc, char* argv[] ) const char * inputFilename2 = argv[2]; const char * outputFilename = argv[4]; - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); - rescaler->SetOutputMinimum( itk::NumericTraits< OutputPixelType >::min()); - rescaler->SetOutputMaximum( itk::NumericTraits< OutputPixelType >::max()); - - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); - filter->SetRadius( atoi(argv[3]) ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); + rescaler->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min()); + rescaler->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max()); - rescaler->SetInput( filter->GetOutput() ); - writer->SetInput( rescaler->GetOutput() ); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + filter->SetRadius(atoi(argv[3])); + rescaler->SetInput(filter->GetOutput()); + writer->SetInput(rescaler->GetOutput()); typedef otb::CommandProgressUpdate<FilterType> CommandType; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); - writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbArcSpatialObjectNew.cxx b/Testing/Code/Common/otbArcSpatialObjectNew.cxx index e4495b17bd..ccc66568e9 100644 --- a/Testing/Code/Common/otbArcSpatialObjectNew.cxx +++ b/Testing/Code/Common/otbArcSpatialObjectNew.cxx @@ -19,7 +19,6 @@ #include "otbArcSpatialObject.h" - int otbArcSpatialObjectNew(int argc, char * argv[]) { const unsigned int Dimension = 2; diff --git a/Testing/Code/Common/otbAttributesMapLabelObjectNew.cxx b/Testing/Code/Common/otbAttributesMapLabelObjectNew.cxx index 54e56e98dd..a75278d532 100644 --- a/Testing/Code/Common/otbAttributesMapLabelObjectNew.cxx +++ b/Testing/Code/Common/otbAttributesMapLabelObjectNew.cxx @@ -20,11 +20,11 @@ int otbAttributesMapLabelObjectNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - - typedef unsigned short LabelType; - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef LabelObjectType::Pointer LabelObjectPointerType; - + + typedef unsigned short LabelType; + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef LabelObjectType::Pointer LabelObjectPointerType; + // Instantiation LabelObjectPointerType myAttMapLabelObject = LabelObjectType::New(); diff --git a/Testing/Code/Common/otbAttributesMapOpeningLabelMapFilterNew.cxx b/Testing/Code/Common/otbAttributesMapOpeningLabelMapFilterNew.cxx index a66e41e350..38c88ae6ea 100644 --- a/Testing/Code/Common/otbAttributesMapOpeningLabelMapFilterNew.cxx +++ b/Testing/Code/Common/otbAttributesMapOpeningLabelMapFilterNew.cxx @@ -22,12 +22,12 @@ int otbAttributesMapOpeningLabelMapFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned short LabelType; - - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef otb::AttributesMapOpeningLabelMapFilter<LabelMapType> OpeningLabelMapFilterType; - + typedef unsigned short LabelType; + + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + typedef otb::AttributesMapOpeningLabelMapFilter<LabelMapType> OpeningLabelMapFilterType; + // Instantiation OpeningLabelMapFilterType::Pointer AttributesMapOpeningLabelMapFilter = OpeningLabelMapFilterType::New(); diff --git a/Testing/Code/Common/otbCommonTests11.cxx b/Testing/Code/Common/otbCommonTests11.cxx index 96c60a0477..31ddce595d 100644 --- a/Testing/Code/Common/otbCommonTests11.cxx +++ b/Testing/Code/Common/otbCommonTests11.cxx @@ -41,5 +41,4 @@ void RegisterTests() REGISTER_TEST(otbLabelObjectMapVectorizer); REGISTER_TEST(otbLabelMapToVectorDataFilter); - } diff --git a/Testing/Code/Common/otbCommonTests2.cxx b/Testing/Code/Common/otbCommonTests2.cxx index 808364dae8..4e0f31fcea 100644 --- a/Testing/Code/Common/otbCommonTests2.cxx +++ b/Testing/Code/Common/otbCommonTests2.cxx @@ -31,8 +31,8 @@ void RegisterTests() REGISTER_TEST(otbExtractROI2); REGISTER_TEST(otbExtractROINew); REGISTER_TEST(otbExtractROI_RGB); - REGISTER_TEST(otbMultiChannelExtractROI ); - REGISTER_TEST(otbMultiChannelExtractROINew ); + REGISTER_TEST(otbMultiChannelExtractROI); + REGISTER_TEST(otbMultiChannelExtractROINew); REGISTER_TEST(otbTestMultiExtractMultiUpdate); REGISTER_TEST(otbVectorDataExtractROINew); REGISTER_TEST(otbVectorDataExtractROI); diff --git a/Testing/Code/Common/otbCommonTests3.cxx b/Testing/Code/Common/otbCommonTests3.cxx index 45fd6a7a23..ed55b6880e 100644 --- a/Testing/Code/Common/otbCommonTests3.cxx +++ b/Testing/Code/Common/otbCommonTests3.cxx @@ -26,8 +26,8 @@ void RegisterTests() { - REGISTER_TEST(otbMultiToMonoChannelExtractROI ); - REGISTER_TEST(otbMultiToMonoChannelExtractROINew ); + REGISTER_TEST(otbMultiToMonoChannelExtractROI); + REGISTER_TEST(otbMultiToMonoChannelExtractROINew); REGISTER_TEST(otbPointSetSourceTest); REGISTER_TEST(otbDrawLineSpatialObjectNew); REGISTER_TEST(otbDrawLineSpatialObject); diff --git a/Testing/Code/Common/otbCommonTests8.cxx b/Testing/Code/Common/otbCommonTests8.cxx index 2d8819bf98..63e946336f 100644 --- a/Testing/Code/Common/otbCommonTests8.cxx +++ b/Testing/Code/Common/otbCommonTests8.cxx @@ -26,13 +26,13 @@ void RegisterTests() { -REGISTER_TEST(otbQuickLookImageGeneratorNew); -REGISTER_TEST(otbQuickLookImageGenerator); -REGISTER_TEST(otbImageRegionTileMapSplitterNew); -REGISTER_TEST(otbImageRegionTileMapSplitter); -REGISTER_TEST(otbImageOfVectorsToMonoChannelExtractROINew); -REGISTER_TEST(otbImageOfVectorsToMonoChannelExtractROI); -REGISTER_TEST(otbImageRegionNonUniformMultidimensionalSplitterNew); -REGISTER_TEST(otbImageRegionNonUniformMultidimensionalSplitter); -REGISTER_TEST(otbVectorImageToASImageAdaptorNew); + REGISTER_TEST(otbQuickLookImageGeneratorNew); + REGISTER_TEST(otbQuickLookImageGenerator); + REGISTER_TEST(otbImageRegionTileMapSplitterNew); + REGISTER_TEST(otbImageRegionTileMapSplitter); + REGISTER_TEST(otbImageOfVectorsToMonoChannelExtractROINew); + REGISTER_TEST(otbImageOfVectorsToMonoChannelExtractROI); + REGISTER_TEST(otbImageRegionNonUniformMultidimensionalSplitterNew); + REGISTER_TEST(otbImageRegionNonUniformMultidimensionalSplitter); + REGISTER_TEST(otbVectorImageToASImageAdaptorNew); } diff --git a/Testing/Code/Common/otbCommonTests9.cxx b/Testing/Code/Common/otbCommonTests9.cxx index 66b5f509ef..179ac07da3 100644 --- a/Testing/Code/Common/otbCommonTests9.cxx +++ b/Testing/Code/Common/otbCommonTests9.cxx @@ -26,8 +26,8 @@ void RegisterTests() { -REGISTER_TEST(otbVectorDataToImageFilterNew); -REGISTER_TEST(otbVectorDataToImageFilter); -REGISTER_TEST(otbVectorDataToImageFilterSensorModel); -REGISTER_TEST(otbVectorDataToImageFilterWorld); + REGISTER_TEST(otbVectorDataToImageFilterNew); + REGISTER_TEST(otbVectorDataToImageFilter); + REGISTER_TEST(otbVectorDataToImageFilterSensorModel); + REGISTER_TEST(otbVectorDataToImageFilterWorld); } diff --git a/Testing/Code/Common/otbConcatenateVectorImageFilter.cxx b/Testing/Code/Common/otbConcatenateVectorImageFilter.cxx index 54ec80b480..02dafa5257 100644 --- a/Testing/Code/Common/otbConcatenateVectorImageFilter.cxx +++ b/Testing/Code/Common/otbConcatenateVectorImageFilter.cxx @@ -24,15 +24,15 @@ int otbConcatenateVectorImageFilter(int argc, char * argv[]) { - const char * filename1 = argv[1]; - const char * filename2 = argv[2]; - const char * outputfilename = argv[3]; + const char * filename1 = argv[1]; + const char * filename2 = argv[2]; + const char * outputfilename = argv[3]; const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef otb::VectorImage<InputPixelType,Dimension> VectorImageType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; - typedef otb::ConcatenateVectorImageFilter<VectorImageType,VectorImageType,VectorImageType> FilterType; + typedef unsigned char InputPixelType; + typedef otb::VectorImage<InputPixelType, Dimension> VectorImageType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; + typedef otb::ConcatenateVectorImageFilter<VectorImageType, VectorImageType, VectorImageType> FilterType; ReaderType::Pointer reader1 = ReaderType::New(); ReaderType::Pointer reader2 = ReaderType::New(); @@ -49,6 +49,5 @@ int otbConcatenateVectorImageFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbConcatenateVectorImageFilterNew.cxx b/Testing/Code/Common/otbConcatenateVectorImageFilterNew.cxx index 66c09e7b33..81479557b4 100644 --- a/Testing/Code/Common/otbConcatenateVectorImageFilterNew.cxx +++ b/Testing/Code/Common/otbConcatenateVectorImageFilterNew.cxx @@ -23,13 +23,12 @@ int otbConcatenateVectorImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::ConcatenateVectorImageFilter<ImageType,ImageType,ImageType> FilterType; + typedef unsigned char PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ConcatenateVectorImageFilter<ImageType, ImageType, ImageType> FilterType; // Instantiating adaptor object FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbConfigurationTest.cxx b/Testing/Code/Common/otbConfigurationTest.cxx index ecf03cbd0c..14027b2834 100644 --- a/Testing/Code/Common/otbConfigurationTest.cxx +++ b/Testing/Code/Common/otbConfigurationTest.cxx @@ -26,29 +26,29 @@ int otbConfigurationTest(int argc, char * argv[]) otbI18nMacro(); // std::cout << "begin config test" << std::endl; - typedef otb::ConfigurationFile ConfigurationType; - + typedef otb::ConfigurationFile ConfigurationType; + //Instantiation // ConfigurationType::Pointer conf = ConfigurationType::GetInstance(); ConfigurationType::Pointer conf = ConfigurationType::GetInstance(); // conf->Load(); std::string lang; try - { + { lang = conf->GetParameter<std::string> ("OTB_LANG"); - } + } catch (...) - { + { std::cout << "Can't get parameter " << lang << std::endl; return EXIT_FAILURE; - } + } std::cout << conf << std::endl; - - if( lang.compare("fr_FR.UTF-8") != 0 && lang.compare("en_EN.UTF-8") !=0 ) - { + + if (lang.compare("fr_FR.UTF-8") != 0 && lang.compare("en_EN.UTF-8") != 0) + { std::cout << "Locale language " << lang << std::endl; return EXIT_FAILURE; - } - + } + return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbDataNodeTest.cxx b/Testing/Code/Common/otbDataNodeTest.cxx index ce6026a00f..217e536e75 100644 --- a/Testing/Code/Common/otbDataNodeTest.cxx +++ b/Testing/Code/Common/otbDataNodeTest.cxx @@ -23,9 +23,9 @@ int otbDataNodeTest(int argc, char * argv[]) { - typedef otb::DataNode<double,2> DataNodeType; - typedef DataNodeType::PointType PointType; - typedef DataNodeType::LineType LineType; + typedef otb::DataNode<double, 2> DataNodeType; + typedef DataNodeType::PointType PointType; + typedef DataNodeType::LineType LineType; typedef DataNodeType::PolygonType PolygonType; DataNodeType::Pointer root = DataNodeType::New(); @@ -52,7 +52,7 @@ int otbDataNodeTest(int argc, char * argv[]) PointType p; p.Fill(5); - point->SetPoint(p);; + point->SetPoint(p); LineType::Pointer l = LineType::New(); line->SetLine(l); @@ -60,29 +60,26 @@ int otbDataNodeTest(int argc, char * argv[]) PolygonType::Pointer pol = PolygonType::New(); polygon->SetPolygonExteriorRing(pol); - - otbControlConditionTestMacro(!root->IsRoot(),"Wrong IsRoot() method return."); - otbControlConditionTestMacro(root->IsDocument(),"Wrong IsDocument() method return."); - otbControlConditionTestMacro(root->IsFolder(),"Wrong IsFolder() method return."); - otbControlConditionTestMacro(root->IsPointFeature(),"Wrong IsPointFeature() method return."); - otbControlConditionTestMacro(root->IsLineFeature(),"Wrong IsLineFeature() method return."); - otbControlConditionTestMacro(root->IsPolygonFeature(),"Wrong IsPolygonFeature() method return."); - - - otbControlConditionTestMacro(document->IsRoot(),"Wrong IsRoot() method return."); - otbControlConditionTestMacro(!document->IsDocument(),"Wrong IsDocument() method return."); - otbControlConditionTestMacro(document->IsFolder(),"Wrong IsFolder() method return."); - otbControlConditionTestMacro(document->IsPointFeature(),"Wrong IsPointFeature() method return."); - otbControlConditionTestMacro(document->IsLineFeature(),"Wrong IsLineFeature() method return."); - otbControlConditionTestMacro(document->IsPolygonFeature(),"Wrong IsPolygonFeature() method return."); - - otbControlConditionTestMacro(folder->IsRoot(),"Wrong IsRoot() method return."); - otbControlConditionTestMacro(folder->IsDocument(),"Wrong IsDocument() method return."); - otbControlConditionTestMacro(!folder->IsFolder(),"Wrong IsFolder() method return."); - otbControlConditionTestMacro(folder->IsPointFeature(),"Wrong IsPointFeature() method return."); - otbControlConditionTestMacro(folder->IsLineFeature(),"Wrong IsLineFeature() method return."); - otbControlConditionTestMacro(folder->IsPolygonFeature(),"Wrong IsPolygonFeature() method return."); - + otbControlConditionTestMacro(!root->IsRoot(), "Wrong IsRoot() method return."); + otbControlConditionTestMacro(root->IsDocument(), "Wrong IsDocument() method return."); + otbControlConditionTestMacro(root->IsFolder(), "Wrong IsFolder() method return."); + otbControlConditionTestMacro(root->IsPointFeature(), "Wrong IsPointFeature() method return."); + otbControlConditionTestMacro(root->IsLineFeature(), "Wrong IsLineFeature() method return."); + otbControlConditionTestMacro(root->IsPolygonFeature(), "Wrong IsPolygonFeature() method return."); + + otbControlConditionTestMacro(document->IsRoot(), "Wrong IsRoot() method return."); + otbControlConditionTestMacro(!document->IsDocument(), "Wrong IsDocument() method return."); + otbControlConditionTestMacro(document->IsFolder(), "Wrong IsFolder() method return."); + otbControlConditionTestMacro(document->IsPointFeature(), "Wrong IsPointFeature() method return."); + otbControlConditionTestMacro(document->IsLineFeature(), "Wrong IsLineFeature() method return."); + otbControlConditionTestMacro(document->IsPolygonFeature(), "Wrong IsPolygonFeature() method return."); + + otbControlConditionTestMacro(folder->IsRoot(), "Wrong IsRoot() method return."); + otbControlConditionTestMacro(folder->IsDocument(), "Wrong IsDocument() method return."); + otbControlConditionTestMacro(!folder->IsFolder(), "Wrong IsFolder() method return."); + otbControlConditionTestMacro(folder->IsPointFeature(), "Wrong IsPointFeature() method return."); + otbControlConditionTestMacro(folder->IsLineFeature(), "Wrong IsLineFeature() method return."); + otbControlConditionTestMacro(folder->IsPolygonFeature(), "Wrong IsPolygonFeature() method return."); return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbDrawLineSpatialObject.cxx b/Testing/Code/Common/otbDrawLineSpatialObject.cxx index f7464c8d55..0e9506a2e2 100644 --- a/Testing/Code/Common/otbDrawLineSpatialObject.cxx +++ b/Testing/Code/Common/otbDrawLineSpatialObject.cxx @@ -32,64 +32,59 @@ #include "otbDrawLineSpatialObjectFilter.h" - -int otbDrawLineSpatialObject( int argc, char* argv[] ) +int otbDrawLineSpatialObject(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; // two points to represent a straight line - double Ux((double)::atof(argv[3])); - double Uy((double)::atof(argv[4])); - double Vx((double)::atof(argv[5])); - double Vy((double)::atof(argv[6])); - + double Ux((double) ::atof(argv[3])); + double Uy((double) ::atof(argv[4])); + double Vx((double) ::atof(argv[5])); + double Vy((double) ::atof(argv[6])); - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::DrawLineSpatialObjectFilter< InputImageType,OutputImageType > FilterType; + typedef otb::DrawLineSpatialObjectFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + + writer->SetFileName(outputFilename); // Definition of the line - typedef itk::LineSpatialObject<2> LineType; + typedef itk::LineSpatialObject<2> LineType; LineType::PointListType list; LineType::LinePointType point; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); list.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); list.push_back(point); LineType::Pointer line = LineType::New(); line->SetId(0); - line->SetPoints( list ); + line->SetPoints(list); line->ComputeBoundingBox(); - filter->SetValue( static_cast<OutputPixelType>(245) ); - filter->SetInputLine( line ); - filter->SetInput( reader->GetOutput() ); - - writer->SetInput( filter->GetOutput() ); + filter->SetValue(static_cast<OutputPixelType>(245)); + filter->SetInputLine(line); + filter->SetInput(reader->GetOutput()); + + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbDrawLineSpatialObjectList.cxx b/Testing/Code/Common/otbDrawLineSpatialObjectList.cxx index aa6a62a380..152e5b728e 100644 --- a/Testing/Code/Common/otbDrawLineSpatialObjectList.cxx +++ b/Testing/Code/Common/otbDrawLineSpatialObjectList.cxx @@ -33,35 +33,33 @@ #include "otbDrawLineSpatialObjectListFilter.h" - -int otbDrawLineSpatialObjectList( int argc, char* argv[] ) +int otbDrawLineSpatialObjectList(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::DrawLineSpatialObjectListFilter< InputImageType,OutputImageType > FilterType; + typedef otb::DrawLineSpatialObjectListFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - typedef otb::LineSpatialObjectList LinesListType; - typedef LinesListType::LineType LineType; + typedef otb::LineSpatialObjectList LinesListType; + typedef LinesListType::LineType LineType; LinesListType::Pointer list = LinesListType::New(); LineType::PointListType pointList; @@ -74,14 +72,14 @@ int otbDrawLineSpatialObjectList( int argc, char* argv[] ) Vx = 35.; Vy = 29.; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); LineType::Pointer line = LineType::New(); line->SetId(0); - line->SetPoints( pointList ); + line->SetPoints(pointList); line->ComputeBoundingBox(); list->push_back(line); @@ -94,15 +92,14 @@ int otbDrawLineSpatialObjectList( int argc, char* argv[] ) Vx = 8.; Vy = 46.; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); - LineType::Pointer line2 = LineType::New(); line2->SetId(0); - line2->SetPoints( pointList ); + line2->SetPoints(pointList); line2->ComputeBoundingBox(); list->push_back(line2); @@ -115,14 +112,14 @@ int otbDrawLineSpatialObjectList( int argc, char* argv[] ) Vx = 22.; Vy = 38.; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); LineType::Pointer line3 = LineType::New(); line3->SetId(0); - line3->SetPoints( pointList ); + line3->SetPoints(pointList); line3->ComputeBoundingBox(); list->push_back(line3); @@ -134,13 +131,10 @@ int otbDrawLineSpatialObjectList( int argc, char* argv[] ) filter->SetInputLineSpatialObjectList(list); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbDrawLineSpatialObjectListNew.cxx b/Testing/Code/Common/otbDrawLineSpatialObjectListNew.cxx index 9abc8d70d9..0af8d61c48 100644 --- a/Testing/Code/Common/otbDrawLineSpatialObjectListNew.cxx +++ b/Testing/Code/Common/otbDrawLineSpatialObjectListNew.cxx @@ -26,22 +26,18 @@ #include "otbDrawLineSpatialObjectListFilter.h" - -int otbDrawLineSpatialObjectListNew( int argc, char* argv[] ) +int otbDrawLineSpatialObjectListNew(int argc, char* argv[]) { - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::DrawLineSpatialObjectListFilter< InputImageType,OutputImageType > FilterType; + typedef otb::DrawLineSpatialObjectListFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbDrawLineSpatialObjectNew.cxx b/Testing/Code/Common/otbDrawLineSpatialObjectNew.cxx index 17e56e0285..5569479b01 100644 --- a/Testing/Code/Common/otbDrawLineSpatialObjectNew.cxx +++ b/Testing/Code/Common/otbDrawLineSpatialObjectNew.cxx @@ -26,22 +26,18 @@ #include "otbDrawLineSpatialObjectFilter.h" - -int otbDrawLineSpatialObjectNew( int argc, char* argv[] ) +int otbDrawLineSpatialObjectNew(int argc, char* argv[]) { - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::DrawLineSpatialObjectFilter< InputImageType,OutputImageType > FilterType; + typedef otb::DrawLineSpatialObjectFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbDrawPathFilter.cxx b/Testing/Code/Common/otbDrawPathFilter.cxx index 7e2cd745a5..a6e7c04977 100644 --- a/Testing/Code/Common/otbDrawPathFilter.cxx +++ b/Testing/Code/Common/otbDrawPathFilter.cxx @@ -24,23 +24,23 @@ int otbDrawPathFilter(int argc, char * argv[]) { - if (argc!=5) - { - std::cout<<"Usgage: "<<argv[0]<<" sizex sizey nbpoints outfname"<<std::endl; + if (argc != 5) + { + std::cout << "Usgage: " << argv[0] << " sizex sizey nbpoints outfname" << std::endl; return EXIT_SUCCESS; - } + } const unsigned int sizex = atoi(argv[1]); const unsigned int sizey = atoi(argv[2]); const unsigned int nbpoints = atoi(argv[3]); - const char * outfname = argv[4]; + const char * outfname = argv[4]; const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef PathType::VertexType VertexType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef PathType::VertexType VertexType; typedef otb::DrawPathFilter<ImageType, PathType, ImageType> DrawPathFilterType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::ImageFileWriter<ImageType> WriterType; ImageType::SizeType size; size[0] = sizex; @@ -57,26 +57,26 @@ int otbDrawPathFilter(int argc, char * argv[]) PathType::Pointer path = PathType::New(); - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=0; - vertex1[1]=i*sizey/nbpoints; - vertex2[0]=i*sizex/nbpoints; - vertex2[1]=0; + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = 0; + vertex1[1] = i * sizey / nbpoints; + vertex2[0] = i * sizex / nbpoints; + vertex2[1] = 0; path->AddVertex(vertex1); path->AddVertex(vertex2); - } - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=i*sizex/nbpoints; - vertex1[1]=sizey-1; - vertex2[0]=sizex-1; - vertex2[1]=i*sizey/nbpoints; + } + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = i * sizex / nbpoints; + vertex1[1] = sizey - 1; + vertex2[0] = sizex - 1; + vertex2[1] = i * sizey / nbpoints; path->AddVertex(vertex1); path->AddVertex(vertex2); - } + } DrawPathFilterType::Pointer filter = DrawPathFilterType::New(); filter->SetImageInput(image); @@ -87,6 +87,5 @@ int otbDrawPathFilter(int argc, char * argv[]) writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbDrawPathFilterNew.cxx b/Testing/Code/Common/otbDrawPathFilterNew.cxx index 736b434762..a9b7001ad4 100644 --- a/Testing/Code/Common/otbDrawPathFilterNew.cxx +++ b/Testing/Code/Common/otbDrawPathFilterNew.cxx @@ -25,13 +25,12 @@ int otbDrawPathFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::DrawPathFilter<ImageType, PathType, ImageType> DrawPathFilterType; DrawPathFilterType::Pointer filter = DrawPathFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbDrawPathListFilter.cxx b/Testing/Code/Common/otbDrawPathListFilter.cxx index 21c9864339..92a64f490f 100644 --- a/Testing/Code/Common/otbDrawPathListFilter.cxx +++ b/Testing/Code/Common/otbDrawPathListFilter.cxx @@ -24,24 +24,24 @@ int otbDrawPathListFilter(int argc, char * argv[]) { - if (argc!=5) - { - std::cout<<"Usgage: "<<argv[0]<<" sizex sizey nbpoints outfname"<<std::endl; + if (argc != 5) + { + std::cout << "Usgage: " << argv[0] << " sizex sizey nbpoints outfname" << std::endl; return EXIT_SUCCESS; - } + } const unsigned int sizex = atoi(argv[1]); const unsigned int sizey = atoi(argv[2]); const unsigned int nbpoints = atoi(argv[3]); - const char * outfname = argv[4]; + const char * outfname = argv[4]; const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef PathType::VertexType VertexType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef PathType::VertexType VertexType; typedef otb::DrawPathListFilter<ImageType, PathType, ImageType> DrawPathListFilterType; - typedef DrawPathListFilterType::InputPathListType PathListType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef DrawPathListFilterType::InputPathListType PathListType; + typedef otb::ImageFileWriter<ImageType> WriterType; ImageType::SizeType size; size[0] = sizex; @@ -58,28 +58,28 @@ int otbDrawPathListFilter(int argc, char * argv[]) PathType::Pointer path1 = PathType::New(); - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=0; - vertex1[1]=i*sizey/nbpoints; - vertex2[0]=i*sizex/nbpoints; - vertex2[1]=0; + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = 0; + vertex1[1] = i * sizey / nbpoints; + vertex2[0] = i * sizex / nbpoints; + vertex2[1] = 0; path1->AddVertex(vertex1); path1->AddVertex(vertex2); - } + } PathType::Pointer path2 = PathType::New(); - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=i*sizex/nbpoints; - vertex1[1]=sizey-1; - vertex2[0]=sizex-1; - vertex2[1]=i*sizey/nbpoints; + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = i * sizex / nbpoints; + vertex1[1] = sizey - 1; + vertex2[0] = sizex - 1; + vertex2[1] = i * sizey / nbpoints; path2->AddVertex(vertex1); path2->AddVertex(vertex2); - } + } PathListType::Pointer pl = PathListType::New(); pl->PushBack(path1); @@ -94,6 +94,5 @@ int otbDrawPathListFilter(int argc, char * argv[]) writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbDrawPathListFilterNew.cxx b/Testing/Code/Common/otbDrawPathListFilterNew.cxx index 109e387d98..7e3458f0d6 100644 --- a/Testing/Code/Common/otbDrawPathListFilterNew.cxx +++ b/Testing/Code/Common/otbDrawPathListFilterNew.cxx @@ -24,14 +24,13 @@ int otbDrawPathListFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::DrawPathListFilter<ImageType, PathType, ImageType> DrawPathListFilterType; // Instantiating object DrawPathListFilterType::Pointer object = DrawPathListFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbDrawPathListFilterWithValue.cxx b/Testing/Code/Common/otbDrawPathListFilterWithValue.cxx index 9df169e170..fded732758 100644 --- a/Testing/Code/Common/otbDrawPathListFilterWithValue.cxx +++ b/Testing/Code/Common/otbDrawPathListFilterWithValue.cxx @@ -24,24 +24,24 @@ int otbDrawPathListFilterWithValue(int argc, char * argv[]) { - if (argc!=5) - { - std::cout<<"Usgage: "<<argv[0]<<" sizex sizey nbpoints outfname"<<std::endl; + if (argc != 5) + { + std::cout << "Usgage: " << argv[0] << " sizex sizey nbpoints outfname" << std::endl; return EXIT_SUCCESS; - } + } const unsigned int sizex = atoi(argv[1]); const unsigned int sizey = atoi(argv[2]); const unsigned int nbpoints = atoi(argv[3]); - const char * outfname = argv[4]; + const char * outfname = argv[4]; const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::PolyLineParametricPathWithValue<PixelType,Dimension> PathType; - typedef PathType::VertexType VertexType; - typedef otb::DrawPathListFilter<ImageType, PathType, ImageType> DrawPathListFilterType; - typedef DrawPathListFilterType::InputPathListType PathListType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::PolyLineParametricPathWithValue<PixelType, Dimension> PathType; + typedef PathType::VertexType VertexType; + typedef otb::DrawPathListFilter<ImageType, PathType, ImageType> DrawPathListFilterType; + typedef DrawPathListFilterType::InputPathListType PathListType; + typedef otb::ImageFileWriter<ImageType> WriterType; ImageType::SizeType size; size[0] = sizex; @@ -58,28 +58,28 @@ int otbDrawPathListFilterWithValue(int argc, char * argv[]) PathType::Pointer path1 = PathType::New(); - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=0; - vertex1[1]=i*sizey/nbpoints; - vertex2[0]=i*sizex/nbpoints; - vertex2[1]=0; + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = 0; + vertex1[1] = i * sizey / nbpoints; + vertex2[0] = i * sizex / nbpoints; + vertex2[1] = 0; path1->AddVertex(vertex1); path1->AddVertex(vertex2); - } + } PathType::Pointer path2 = PathType::New(); - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=i*sizex/nbpoints; - vertex1[1]=sizey-1; - vertex2[0]=sizex-1; - vertex2[1]=i*sizey/nbpoints; + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = i * sizex / nbpoints; + vertex1[1] = sizey - 1; + vertex2[0] = sizex - 1; + vertex2[1] = i * sizey / nbpoints; path2->AddVertex(vertex1); path2->AddVertex(vertex2); - } + } PathListType::Pointer pl = PathListType::New(); path1->SetValue(200); @@ -97,6 +97,5 @@ int otbDrawPathListFilterWithValue(int argc, char * argv[]) writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbExtractROI.cxx b/Testing/Code/Common/otbExtractROI.cxx index 10b9c6a94a..a7706c6eb3 100644 --- a/Testing/Code/Common/otbExtractROI.cxx +++ b/Testing/Code/Common/otbExtractROI.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -24,45 +23,42 @@ #include "otbExtractROI.h" -int otbExtractROI( int argc, char * argv[] ) +int otbExtractROI(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int startX((unsigned int)::atoi(argv[3])); - unsigned int startY((unsigned int)::atoi(argv[4])); - unsigned int sizeX((unsigned int)::atoi(argv[5])); - unsigned int sizeY((unsigned int)::atoi(argv[6])); + unsigned int startX((unsigned int) ::atoi(argv[3])); + unsigned int startY((unsigned int) ::atoi(argv[4])); + unsigned int sizeX((unsigned int) ::atoi(argv[5])); + unsigned int sizeY((unsigned int) ::atoi(argv[6])); - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; - typedef otb::ExtractROI< InputPixelType, - OutputPixelType > FilterType; + typedef otb::ExtractROI<InputPixelType, + OutputPixelType> FilterType; - typedef FilterType::InputImageType InputImageType; - typedef FilterType::OutputImageType OutputImageType; + typedef FilterType::InputImageType InputImageType; + typedef FilterType::OutputImageType OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; FilterType::Pointer filter = FilterType::New(); - filter->SetStartX( startX ); - filter->SetStartY( startY ); - filter->SetSizeX( sizeX ); - filter->SetSizeY( sizeY ); + filter->SetStartX(startX); + filter->SetStartY(startY); + filter->SetSizeX(sizeX); + filter->SetSizeY(sizeY); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbExtractROI2.cxx b/Testing/Code/Common/otbExtractROI2.cxx index e49914d579..e0d8a7b1d6 100644 --- a/Testing/Code/Common/otbExtractROI2.cxx +++ b/Testing/Code/Common/otbExtractROI2.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -24,56 +23,53 @@ #include "otbExtractROI.h" -int otbExtractROI2( int argc, char * argv[] ) +int otbExtractROI2(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int startX((unsigned int)::atoi(argv[3])); - unsigned int startY((unsigned int)::atoi(argv[4])); - unsigned int sizeX((unsigned int)::atoi(argv[5])); - unsigned int sizeY((unsigned int)::atoi(argv[6])); + unsigned int startX((unsigned int) ::atoi(argv[3])); + unsigned int startY((unsigned int) ::atoi(argv[4])); + unsigned int sizeX((unsigned int) ::atoi(argv[5])); + unsigned int sizeY((unsigned int) ::atoi(argv[6])); - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; - typedef otb::ExtractROI< InputPixelType, - OutputPixelType > FilterType; + typedef otb::ExtractROI<InputPixelType, + OutputPixelType> FilterType; - typedef FilterType::InputImageType InputImageType; - typedef FilterType::OutputImageType OutputImageType; + typedef FilterType::InputImageType InputImageType; + typedef FilterType::OutputImageType OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; FilterType::Pointer filter = FilterType::New(); - typedef otb::Image<InputPixelType,2> ImageType; + typedef otb::Image<InputPixelType, 2> ImageType; ImageType::IndexType start; start[0] = startX; start[1] = startY; - ImageType::SizeType size; + ImageType::SizeType size; size[0] = sizeX; size[1] = sizeY; ImageType::RegionType region; - region.SetSize( size ); - region.SetIndex( start ); + region.SetSize(size); + region.SetIndex(start); filter->SetExtractionRegion(region); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbExtractROINew.cxx b/Testing/Code/Common/otbExtractROINew.cxx index 39d5a4dc3d..51f4a1883c 100644 --- a/Testing/Code/Common/otbExtractROINew.cxx +++ b/Testing/Code/Common/otbExtractROINew.cxx @@ -16,24 +16,19 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "itkImage.h" #include "otbExtractROI.h" -int otbExtractROINew( int argc, char * argv[] ) +int otbExtractROINew(int argc, char * argv[]) { - typedef std::complex<float> InputPixelType; - typedef std::complex<double> OutputPixelType; - - typedef otb::ExtractROI< InputPixelType, OutputPixelType > FilterType; + typedef std::complex<float> InputPixelType; + typedef std::complex<double> OutputPixelType; + typedef otb::ExtractROI<InputPixelType, OutputPixelType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbExtractROI_RGB.cxx b/Testing/Code/Common/otbExtractROI_RGB.cxx index 372d8cd295..a306f08ea3 100644 --- a/Testing/Code/Common/otbExtractROI_RGB.cxx +++ b/Testing/Code/Common/otbExtractROI_RGB.cxx @@ -18,53 +18,49 @@ #include "itkExceptionObject.h" - #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbExtractROI.h" #include "itkImage.h" #include "itkRGBPixel.h" - -int otbExtractROI_RGB( int argc, char * argv[] ) +int otbExtractROI_RGB(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int startX((unsigned int)::atoi(argv[3])); - unsigned int startY((unsigned int)::atoi(argv[4])); - unsigned int sizeX((unsigned int)::atoi(argv[5])); - unsigned int sizeY((unsigned int)::atoi(argv[6])); + unsigned int startX((unsigned int) ::atoi(argv[3])); + unsigned int startY((unsigned int) ::atoi(argv[4])); + unsigned int sizeX((unsigned int) ::atoi(argv[5])); + unsigned int sizeY((unsigned int) ::atoi(argv[6])); - typedef itk::RGBPixel<unsigned char> InputPixelType; - typedef itk::RGBPixel<unsigned char> OutputPixelType; + typedef itk::RGBPixel<unsigned char> InputPixelType; + typedef itk::RGBPixel<unsigned char> OutputPixelType; - typedef otb::ExtractROI< InputPixelType, - OutputPixelType > FilterType; + typedef otb::ExtractROI<InputPixelType, + OutputPixelType> FilterType; - typedef FilterType::InputImageType InputImageType; - typedef FilterType::OutputImageType OutputImageType; + typedef FilterType::InputImageType InputImageType; + typedef FilterType::OutputImageType OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; FilterType::Pointer filter = FilterType::New(); - filter->SetStartX( startX ); - filter->SetStartY( startY ); - filter->SetSizeX( sizeX ); - filter->SetSizeY( sizeY ); + filter->SetStartX(startX); + filter->SetStartY(startY); + filter->SetSizeX(sizeX); + filter->SetSizeY(sizeY); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbGISTableToLabelMapFilterNew.cxx b/Testing/Code/Common/otbGISTableToLabelMapFilterNew.cxx index d59cef11f9..c6dc59f12d 100644 --- a/Testing/Code/Common/otbGISTableToLabelMapFilterNew.cxx +++ b/Testing/Code/Common/otbGISTableToLabelMapFilterNew.cxx @@ -26,12 +26,12 @@ int otbGISTableToLabelMapFilterNew(int argc, char * argv[]) const int Dimension = 2; typedef double PType; - typedef otb::PostGISConnectionImplementation BdConnection; + typedef otb::PostGISConnectionImplementation BdConnection; typedef otb::GISTable<BdConnection, PType, Dimension> GISTableType; - typedef itk::AttributeLabelObject< unsigned long, Dimension, double > LabelObjectType; + typedef itk::AttributeLabelObject<unsigned long, Dimension, double> LabelObjectType; - typedef itk::LabelMap< LabelObjectType > LabelMapType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; typedef otb::GISTableToLabelMapFilter<GISTableType, LabelMapType> GISTableToLabelMapFilterType; @@ -39,5 +39,3 @@ int otbGISTableToLabelMapFilterNew(int argc, char * argv[]) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbGISTableToVectorDataFilter.cxx b/Testing/Code/Common/otbGISTableToVectorDataFilter.cxx index f09ef87a02..b87d726ebe 100644 --- a/Testing/Code/Common/otbGISTableToVectorDataFilter.cxx +++ b/Testing/Code/Common/otbGISTableToVectorDataFilter.cxx @@ -28,55 +28,53 @@ int otbGISTableToVectorDataFilter(int argc, char * argv[]) { /** Read a PostGIS table and write it in a VectorData. The Filter is based on the OGR reader/writer factory*/ - if ( argc != 6 ) - { + if (argc != 6) + { std::cerr << "Usage: " << argv[0]; std::cerr << " outputFile(shp) dbName tableName userName userPassword" << std::endl; return EXIT_FAILURE; - } - + } + const int dim = 2; - + const std::string dbName = argv[2]; const std::string tableName = argv[3]; const std::string userName = argv[4]; const std::string userPassword = argv[5]; - - - - typedef unsigned char PType; - typedef otb::VectorData<double, dim> VectorDataType; - typedef otb::PostGISConnectionImplementation GISConnectionType; - typedef GISConnectionType::Pointer GISConnectionPointerType; + + typedef unsigned char PType; + typedef otb::VectorData<double, dim> VectorDataType; + typedef otb::PostGISConnectionImplementation GISConnectionType; + typedef GISConnectionType::Pointer GISConnectionPointerType; typedef otb::PostGISTable<GISConnectionType, double, dim> GISTableType; //Instantiation GISTableType::Pointer data = GISTableType::New(); - + GISConnectionPointerType myConnection = GISConnectionType::New(); - - myConnection->SetHost( "localhost" ); - myConnection->SetDBName( dbName ); - myConnection->SetUser( userName ); - myConnection->SetPassword( userPassword ); - + + myConnection->SetHost("localhost"); + myConnection->SetDBName(dbName); + myConnection->SetUser(userName); + myConnection->SetPassword(userPassword); + data->SetConnection(myConnection); data->SetTableName(tableName); - - typedef otb::GISTableToVectorDataFilter< GISTableType , VectorDataType > GISTableToVectorDataFilter; - + + typedef otb::GISTableToVectorDataFilter<GISTableType, VectorDataType> GISTableToVectorDataFilter; + GISTableToVectorDataFilter::Pointer MyFilter = GISTableToVectorDataFilter::New(); std::cout << MyFilter << std::endl; MyFilter->SetInput(data); MyFilter->Update(); typedef otb::VectorDataFileWriter<VectorDataType> WriterType; - + WriterType::Pointer writer = WriterType::New(); - + writer->SetFileName(argv[1]); writer->SetInput(MyFilter->GetOutput()); writer->Update(); //data->itkGetObjectMacro ( ) - + return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbGISTableToVectorDataFilterNew.cxx b/Testing/Code/Common/otbGISTableToVectorDataFilterNew.cxx index be4fe26f9f..ed186cee09 100644 --- a/Testing/Code/Common/otbGISTableToVectorDataFilterNew.cxx +++ b/Testing/Code/Common/otbGISTableToVectorDataFilterNew.cxx @@ -25,20 +25,20 @@ int otbGISTableToVectorDataFilterNew(int argc, char * argv[]) { - - typedef unsigned char PType; - typedef otb::VectorData<> VectorDataType; - typedef otb::PostGISConnectionImplementation GISConnectionType; + + typedef unsigned char PType; + typedef otb::VectorData<> VectorDataType; + typedef otb::PostGISConnectionImplementation GISConnectionType; typedef otb::GISTable<GISConnectionType, double, 2> GISTableType; //Instantiation GISTableType::Pointer data = GISTableType::New(); - typedef otb::GISTableToVectorDataFilter< GISTableType , VectorDataType > GISTableToVectorDataFilter; + typedef otb::GISTableToVectorDataFilter<GISTableType, VectorDataType> GISTableToVectorDataFilter; GISTableToVectorDataFilter::Pointer MyFilter = GISTableToVectorDataFilter::New(); - + //data->itkGetObjectMacro ( ) - + return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbGenericInterpolateImageFunctionNew.cxx b/Testing/Code/Common/otbGenericInterpolateImageFunctionNew.cxx index b2aa80d840..bd179a4c11 100644 --- a/Testing/Code/Common/otbGenericInterpolateImageFunctionNew.cxx +++ b/Testing/Code/Common/otbGenericInterpolateImageFunctionNew.cxx @@ -21,22 +21,21 @@ #include "otbImage.h" #include "itkConstantBoundaryCondition.h" - namespace Function { -template< class TInput=double, class TOutput=double > +template<class TInput = double, class TOutput = double> class SameFunction { public: void SetRadius(unsigned int rad) { m_Radius = rad; - }; + } unsigned int GetRadius() const { return m_Radius; - }; - inline TOutput operator()( const TInput & A ) const + } + inline TOutput operator ()(const TInput& A) const { return static_cast<TOutput>(A); } @@ -45,18 +44,18 @@ public: } - int otbGenericInterpolateImageFunctionNew(int argc, char * argv[]) { - typedef double InputPixelType; + typedef double InputPixelType; const int Dimension = 2; - typedef otb::Image<InputPixelType,Dimension> ImageType; - typedef Function::SameFunction<InputPixelType,InputPixelType > FunctionType; - typedef itk::ConstantBoundaryCondition< ImageType > BoundaryConditionType; - typedef double CoordRepType; + typedef otb::Image<InputPixelType, Dimension> ImageType; + typedef Function::SameFunction<InputPixelType, InputPixelType> FunctionType; + typedef itk::ConstantBoundaryCondition<ImageType> BoundaryConditionType; + typedef double CoordRepType; - typedef otb::GenericInterpolateImageFunction<ImageType, FunctionType, BoundaryConditionType, CoordRepType> GenericFunctionType; + typedef otb::GenericInterpolateImageFunction<ImageType, FunctionType, BoundaryConditionType, + CoordRepType> GenericFunctionType; // Instantiating object GenericFunctionType::Pointer generic = GenericFunctionType::New(); diff --git a/Testing/Code/Common/otbHistogramStatisticsFunction.cxx b/Testing/Code/Common/otbHistogramStatisticsFunction.cxx index c73e0fa637..ac930950d3 100644 --- a/Testing/Code/Common/otbHistogramStatisticsFunction.cxx +++ b/Testing/Code/Common/otbHistogramStatisticsFunction.cxx @@ -25,10 +25,10 @@ int otbHistogramStatisticsFunction(int argc, char* argv[]) { - unsigned int NbOfBins((unsigned int)::atoi(argv[1])); + unsigned int NbOfBins((unsigned int) ::atoi(argv[1])); - typedef float MeasurementType; - typedef itk::Statistics::Histogram< MeasurementType, 1 > HistogramType; + typedef float MeasurementType; + typedef itk::Statistics::Histogram<MeasurementType, 1> HistogramType; HistogramType::Pointer histogram = HistogramType::New(); // initialize histogram @@ -39,21 +39,19 @@ int otbHistogramStatisticsFunction(int argc, char* argv[]) lowerBound[0] = 0.0; upperBound[0] = NbOfBins; - histogram->Initialize(size, lowerBound, upperBound ); - + histogram->Initialize(size, lowerBound, upperBound); // create histogram with same value for each frequency for (HistogramType::Iterator iter = histogram->Begin(); iter != histogram->End(); ++iter) - { + { iter.SetFrequency(1.0); - } + } - typedef otb::HistogramStatisticsFunction<HistogramType,MeasurementType> HistogramStatisticsFunctionType; + typedef otb::HistogramStatisticsFunction<HistogramType, MeasurementType> HistogramStatisticsFunctionType; HistogramStatisticsFunctionType::Pointer HistogramStatisticsFunction = HistogramStatisticsFunctionType::New(); HistogramStatisticsFunction->SetInputHistogram(histogram.GetPointer()); - MeasurementType Entropy; MeasurementType Mean; MeasurementType Covariance; @@ -65,71 +63,71 @@ int otbHistogramStatisticsFunction(int argc, char* argv[]) Entropy = HistogramStatisticsFunction->GetEntropy()[0]; std::cout << "Entropy 1 : " << Entropy << std::endl; - if (vcl_abs(Entropy-vcl_log(static_cast<double>(NbOfBins)))>0.00001 ) - { + if (vcl_abs(Entropy - vcl_log(static_cast<double>(NbOfBins))) > 0.00001) + { std::cout << "Error in entropy estimation" << std::endl; return EXIT_FAILURE; - } + } Mean = HistogramStatisticsFunction->GetMean()[0]; std::cout << "Mean 1 : " << Mean << std::endl; - if ( Mean != NbOfBins/2. ) - { + if (Mean != NbOfBins / 2.) + { std::cout << "Error in mean estimation" << std::endl; return EXIT_FAILURE; - } + } Covariance = HistogramStatisticsFunction->GetCovariance()[0]; std::cout << "Covariance 1 : " << Covariance << std::endl; - if ( Covariance != 0 ) - { + if (Covariance != 0) + { std::cout << "Error in covariance estimation" << std::endl; return EXIT_FAILURE; - } + } // create histogram just all value equal to zero except the first one for (HistogramType::Iterator iter = histogram->Begin(); iter != histogram->End(); ++iter) - { - if (iter == histogram->Begin()) { + if (iter == histogram->Begin()) + { iter.SetFrequency(1.0); - } + } else - { + { iter.SetFrequency(0.0); + } } - } HistogramStatisticsFunction->Update(); Entropy = HistogramStatisticsFunction->GetEntropy()[0]; std::cout << "Entropy 2 : " << Entropy << std::endl; - if ( Entropy!=0.0 ) - { + if (Entropy != 0.0) + { std::cout << "Error in entropy estimation" << std::endl; return EXIT_FAILURE; - } + } Mean = HistogramStatisticsFunction->GetMean()[0]; std::cout << "Mean 2 : " << Mean << std::endl; - if ( Mean != 0.5 ) - { + if (Mean != 0.5) + { std::cout << "Error in mean estimation" << std::endl; return EXIT_FAILURE; - } + } Covariance = HistogramStatisticsFunction->GetCovariance()[0]; std::cout << "Covariance 2 : " << Covariance << std::endl; - if ( Covariance != 0 ) - { + if (Covariance != 0) + { std::cout << "Error in covariance estimation" << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbImageList.cxx b/Testing/Code/Common/otbImageList.cxx index 5b2f46b31b..db019263ce 100644 --- a/Testing/Code/Common/otbImageList.cxx +++ b/Testing/Code/Common/otbImageList.cxx @@ -24,15 +24,15 @@ int otbImageList(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<InputImageType> WriterType; - typedef otb::ImageList<InputImageType> ImageListType; + typedef unsigned char InputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<InputImageType> WriterType; + typedef otb::ImageList<InputImageType> ImageListType; // Reading image ReaderType::Pointer reader = ReaderType::New(); @@ -51,6 +51,5 @@ int otbImageList(int argc, char * argv[]) writer->SetInput(imageList->Back()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbImageListNew.cxx b/Testing/Code/Common/otbImageListNew.cxx index e7b6b33ac0..1900c7347d 100644 --- a/Testing/Code/Common/otbImageListNew.cxx +++ b/Testing/Code/Common/otbImageListNew.cxx @@ -24,13 +24,12 @@ int otbImageListNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::ImageList<InputImageType> ImageListType; + typedef unsigned char InputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageList<InputImageType> ImageListType; // Instantiating ImageList object ImageListType::Pointer imageList = ImageListType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbImageListSourceNew.cxx b/Testing/Code/Common/otbImageListSourceNew.cxx index bf81debc23..5b879c7eb4 100644 --- a/Testing/Code/Common/otbImageListSourceNew.cxx +++ b/Testing/Code/Common/otbImageListSourceNew.cxx @@ -23,13 +23,12 @@ int otbImageListSourceNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::ImageListSource<InputImageType> ImageListSourceType; + typedef unsigned char InputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageListSource<InputImageType> ImageListSourceType; // Instantiating ImageListSource object ImageListSourceType::Pointer imageList = ImageListSourceType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbImageListToImageFilterNew.cxx b/Testing/Code/Common/otbImageListToImageFilterNew.cxx index 5b65100f06..dc1b316deb 100644 --- a/Testing/Code/Common/otbImageListToImageFilterNew.cxx +++ b/Testing/Code/Common/otbImageListToImageFilterNew.cxx @@ -23,15 +23,14 @@ int otbImageListToImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageListToImageFilter<InputImageType,OutputImageType> ImageListToImageFilterType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageListToImageFilter<InputImageType, OutputImageType> ImageListToImageFilterType; // Instantiating ImageListSource object ImageListToImageFilterType::Pointer imageList = ImageListToImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbImageListToImageListFilterNew.cxx b/Testing/Code/Common/otbImageListToImageListFilterNew.cxx index 7db984955e..816c0edfeb 100644 --- a/Testing/Code/Common/otbImageListToImageListFilterNew.cxx +++ b/Testing/Code/Common/otbImageListToImageListFilterNew.cxx @@ -23,15 +23,14 @@ int otbImageListToImageListFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageListToImageListFilter<InputImageType,OutputImageType> ImageToImageListFilterType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageListToImageListFilter<InputImageType, OutputImageType> ImageToImageListFilterType; // Instantiating ImageListSource object ImageToImageListFilterType::Pointer imageList = ImageToImageListFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROI.cxx b/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROI.cxx index 87576ac837..7264c57c19 100644 --- a/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROI.cxx +++ b/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROI.cxx @@ -23,22 +23,22 @@ int otbImageOfVectorsToMonoChannelExtractROI(int argc, char * argv[]) { const int Dimension = 2; - typedef unsigned char ScalarPixelType; - typedef itk::Vector<unsigned char,Dimension> VectorPixelType; + typedef unsigned char ScalarPixelType; + typedef itk::Vector<unsigned char, Dimension> VectorPixelType; const char * inputImageFileName = argv[1]; const char * outputImageFileName = argv[7]; - typedef otb::Image<ScalarPixelType,Dimension> ScalarImageType; - typedef otb::Image<VectorPixelType,Dimension> VectorImageType; + typedef otb::Image<ScalarPixelType, Dimension> ScalarImageType; + typedef otb::Image<VectorPixelType, Dimension> VectorImageType; typedef otb::ImageOfVectorsToMonoChannelExtractROI<VectorImageType, ScalarImageType> FilterType; - typedef otb::ImageFileReader< VectorImageType > ReaderType; - typedef otb::ImageFileWriter< ScalarImageType > WriterType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::ImageFileWriter<ScalarImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputImageFileName ); + reader->SetFileName(inputImageFileName); WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputImageFileName ); + writer->SetFileName(outputImageFileName); // Instantiating object FilterType::Pointer object = FilterType::New(); diff --git a/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROINew.cxx b/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROINew.cxx index 52843ff011..cac151e27f 100644 --- a/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROINew.cxx +++ b/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROINew.cxx @@ -21,11 +21,11 @@ int otbImageOfVectorsToMonoChannelExtractROINew(int argc, char * argv[]) { const int Dimension = 2; - typedef unsigned char ScalarPixelType; - typedef itk::Vector<double,Dimension> VectorPixelType; + typedef unsigned char ScalarPixelType; + typedef itk::Vector<double, Dimension> VectorPixelType; - typedef otb::Image<ScalarPixelType,Dimension> ScalarImageType; - typedef otb::Image<VectorPixelType,Dimension> VectorImageType; + typedef otb::Image<ScalarPixelType, Dimension> ScalarImageType; + typedef otb::Image<VectorPixelType, Dimension> VectorImageType; typedef otb::ImageOfVectorsToMonoChannelExtractROI<VectorImageType, ScalarImageType> FilterType; // Instantiating object diff --git a/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitter.cxx b/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitter.cxx index 238790004e..b3cc837728 100644 --- a/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitter.cxx +++ b/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitter.cxx @@ -18,13 +18,13 @@ #include "otbImageRegionNonUniformMultidimensionalSplitter.h" #include <fstream> -int otbImageRegionNonUniformMultidimensionalSplitter( int argc, char * argv[] ) +int otbImageRegionNonUniformMultidimensionalSplitter(int argc, char * argv[]) { const int Dimension = 2; - typedef otb::ImageRegionNonUniformMultidimensionalSplitter< Dimension > FilterType; - typedef FilterType::IndexType IndexType; - typedef FilterType::SizeType SizeType; - typedef FilterType::RegionType RegionType; + typedef otb::ImageRegionNonUniformMultidimensionalSplitter<Dimension> FilterType; + typedef FilterType::IndexType IndexType; + typedef FilterType::SizeType SizeType; + typedef FilterType::RegionType RegionType; IndexType index; index[0] = atoi(argv[1]); @@ -36,7 +36,6 @@ int otbImageRegionNonUniformMultidimensionalSplitter( int argc, char * argv[] ) unsigned int nbAsked(atoi(argv[6])); const char * outfname(argv[7]); - RegionType region; region.SetSize(size); @@ -44,22 +43,19 @@ int otbImageRegionNonUniformMultidimensionalSplitter( int argc, char * argv[] ) FilterType::Pointer filter = FilterType::New(); - unsigned int nb = filter->GetNumberOfSplits(region,nbSplitTheoric); - - RegionType region2 = filter->GetSplit(nbAsked,nb,region); + unsigned int nb = filter->GetNumberOfSplits(region, nbSplitTheoric); - std::ofstream outfile(outfname); + RegionType region2 = filter->GetSplit(nbAsked, nb, region); + std::ofstream outfile(outfname); - outfile << "Input region: "<<region<<std::endl; - outfile << "Input NumberOfSplits: "<<nbSplitTheoric<<std::endl; - outfile << "Output GetNumberOfSplits: "<<nb<<std::endl; - outfile << "Output GetSplit("<<nbAsked<<","<<nb<<",input region): "<<std::endl; - outfile << " "<<region2<<std::endl; + outfile << "Input region: " << region << std::endl; + outfile << "Input NumberOfSplits: " << nbSplitTheoric << std::endl; + outfile << "Output GetNumberOfSplits: " << nb << std::endl; + outfile << "Output GetSplit(" << nbAsked << "," << nb << ",input region): " << std::endl; + outfile << " " << region2 << std::endl; outfile.close(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitterNew.cxx b/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitterNew.cxx index a6eb8df6fa..7ea525a474 100644 --- a/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitterNew.cxx +++ b/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitterNew.cxx @@ -17,14 +17,12 @@ =========================================================================*/ #include "otbImageRegionNonUniformMultidimensionalSplitter.h" -int otbImageRegionNonUniformMultidimensionalSplitterNew( int argc, char * argv[] ) +int otbImageRegionNonUniformMultidimensionalSplitterNew(int argc, char * argv[]) { const int Dimension = 2; - typedef otb::ImageRegionNonUniformMultidimensionalSplitter< Dimension > FilterType; + typedef otb::ImageRegionNonUniformMultidimensionalSplitter<Dimension> FilterType; FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbImageRegionTileMapSplitter.cxx b/Testing/Code/Common/otbImageRegionTileMapSplitter.cxx index ef069b72c9..703a78597c 100644 --- a/Testing/Code/Common/otbImageRegionTileMapSplitter.cxx +++ b/Testing/Code/Common/otbImageRegionTileMapSplitter.cxx @@ -18,23 +18,22 @@ #include "otbImageRegionTileMapSplitter.h" #include <fstream> -int otbImageRegionTileMapSplitter( int argc, char * argv[] ) +int otbImageRegionTileMapSplitter(int argc, char * argv[]) { - const int Dimension = 2; - typedef otb::ImageRegionTileMapSplitter< Dimension > FilterType; - typedef FilterType::IndexType IndexType; - typedef FilterType::SizeType SizeType; - typedef FilterType::RegionType RegionType; + typedef otb::ImageRegionTileMapSplitter<Dimension> FilterType; + typedef FilterType::IndexType IndexType; + typedef FilterType::SizeType SizeType; + typedef FilterType::RegionType RegionType; - std::ofstream outfile(argv[1]); + std::ofstream outfile(argv[1]); FilterType::Pointer filter = FilterType::New(); - RegionType region, region2; + RegionType region, region2; unsigned int nb, nbSplitTheoric, nbAsked; - IndexType index; - SizeType size; + IndexType index; + SizeType size; //Case 1 index[0] = 45; @@ -47,15 +46,15 @@ int otbImageRegionTileMapSplitter( int argc, char * argv[] ) region.SetSize(size); region.SetIndex(index); - nb = filter->GetNumberOfSplits(region,nbSplitTheoric); - region2 = filter->GetSplit(nbAsked,nb,region); + nb = filter->GetNumberOfSplits(region, nbSplitTheoric); + region2 = filter->GetSplit(nbAsked, nb, region); outfile << "\nCase 1 \n"; - outfile << "Input region: "<<region<<std::endl; - outfile << "Input NumberOfSplits: "<<nbSplitTheoric<<std::endl; - outfile << "Output GetNumberOfSplits: "<<nb<<std::endl; - outfile << "Output GetSplit("<<nbAsked<<","<<nb<<",input region): "<<std::endl; - outfile << "Output region: "<< region2<<std::endl; + outfile << "Input region: " << region << std::endl; + outfile << "Input NumberOfSplits: " << nbSplitTheoric << std::endl; + outfile << "Output GetNumberOfSplits: " << nb << std::endl; + outfile << "Output GetSplit(" << nbAsked << "," << nb << ",input region): " << std::endl; + outfile << "Output region: " << region2 << std::endl; //Case 2 index[0] = 45; @@ -68,15 +67,15 @@ int otbImageRegionTileMapSplitter( int argc, char * argv[] ) region.SetSize(size); region.SetIndex(index); - nb = filter->GetNumberOfSplits(region,nbSplitTheoric); - region2 = filter->GetSplit(nbAsked,nb,region); + nb = filter->GetNumberOfSplits(region, nbSplitTheoric); + region2 = filter->GetSplit(nbAsked, nb, region); outfile << "\nCase 2 \n"; - outfile << "Input region: "<<region<<std::endl; - outfile << "Input NumberOfSplits: "<<nbSplitTheoric<<std::endl; - outfile << "Output GetNumberOfSplits: "<<nb<<std::endl; - outfile << "Output GetSplit("<<nbAsked<<","<<nb<<",input region): "<<std::endl; - outfile << "Output region: "<< region2<<std::endl; + outfile << "Input region: " << region << std::endl; + outfile << "Input NumberOfSplits: " << nbSplitTheoric << std::endl; + outfile << "Output GetNumberOfSplits: " << nb << std::endl; + outfile << "Output GetSplit(" << nbAsked << "," << nb << ",input region): " << std::endl; + outfile << "Output region: " << region2 << std::endl; //Case 3 index[0] = 45; @@ -89,16 +88,16 @@ int otbImageRegionTileMapSplitter( int argc, char * argv[] ) region.SetSize(size); region.SetIndex(index); - nb = filter->GetNumberOfSplits(region,nbSplitTheoric); - region2 = filter->GetSplit(nbAsked,nb,region); + nb = filter->GetNumberOfSplits(region, nbSplitTheoric); + region2 = filter->GetSplit(nbAsked, nb, region); outfile << "\nCase 3 \n"; - outfile << "Input region: "<<region<<std::endl; - outfile << "Input NumberOfSplits: "<<nbSplitTheoric<<std::endl; - outfile << "Output GetNumberOfSplits: "<<nb<<std::endl; - outfile << "Output GetSplit("<<nbAsked<<","<<nb<<",input region): "<<std::endl; - outfile << "Output region: "<< region2<<std::endl; - + outfile << "Input region: " << region << std::endl; + outfile << "Input NumberOfSplits: " << nbSplitTheoric << std::endl; + outfile << "Output GetNumberOfSplits: " << nb << std::endl; + outfile << "Output GetSplit(" << nbAsked << "," << nb << ",input region): " << std::endl; + outfile << "Output region: " << region2 << std::endl; + //Case 4 index[0] = 45; index[1] = 45; @@ -110,15 +109,15 @@ int otbImageRegionTileMapSplitter( int argc, char * argv[] ) region.SetSize(size); region.SetIndex(index); - nb = filter->GetNumberOfSplits(region,nbSplitTheoric); - region2 = filter->GetSplit(nbAsked,nb,region); + nb = filter->GetNumberOfSplits(region, nbSplitTheoric); + region2 = filter->GetSplit(nbAsked, nb, region); outfile << "\nCase 4 \n"; - outfile << "Input region: "<<region<<std::endl; - outfile << "Input NumberOfSplits: "<<nbSplitTheoric<<std::endl; - outfile << "Output GetNumberOfSplits: "<<nb<<std::endl; - outfile << "Output GetSplit("<<nbAsked<<","<<nb<<",input region): "<<std::endl; - outfile << "Output region: "<< region2<<std::endl; + outfile << "Input region: " << region << std::endl; + outfile << "Input NumberOfSplits: " << nbSplitTheoric << std::endl; + outfile << "Output GetNumberOfSplits: " << nb << std::endl; + outfile << "Output GetSplit(" << nbAsked << "," << nb << ",input region): " << std::endl; + outfile << "Output region: " << region2 << std::endl; //Case 5 index[0] = 0; @@ -131,15 +130,15 @@ int otbImageRegionTileMapSplitter( int argc, char * argv[] ) region.SetSize(size); region.SetIndex(index); - nb = filter->GetNumberOfSplits(region,nbSplitTheoric); - region2 = filter->GetSplit(nbAsked,nb,region); + nb = filter->GetNumberOfSplits(region, nbSplitTheoric); + region2 = filter->GetSplit(nbAsked, nb, region); outfile << "\nCase 5 \n"; - outfile << "Input region: "<<region<<std::endl; - outfile << "Input NumberOfSplits: "<<nbSplitTheoric<<std::endl; - outfile << "Output GetNumberOfSplits: "<<nb<<std::endl; - outfile << "Output GetSplit("<<nbAsked<<","<<nb<<",input region): "<<std::endl; - outfile << "Output region: "<< region2<<std::endl; + outfile << "Input region: " << region << std::endl; + outfile << "Input NumberOfSplits: " << nbSplitTheoric << std::endl; + outfile << "Output GetNumberOfSplits: " << nb << std::endl; + outfile << "Output GetSplit(" << nbAsked << "," << nb << ",input region): " << std::endl; + outfile << "Output region: " << region2 << std::endl; outfile.close(); diff --git a/Testing/Code/Common/otbImageRegionTileMapSplitterNew.cxx b/Testing/Code/Common/otbImageRegionTileMapSplitterNew.cxx index b0b35026b6..3e024049dd 100644 --- a/Testing/Code/Common/otbImageRegionTileMapSplitterNew.cxx +++ b/Testing/Code/Common/otbImageRegionTileMapSplitterNew.cxx @@ -17,14 +17,12 @@ =========================================================================*/ #include "otbImageRegionTileMapSplitter.h" -int otbImageRegionTileMapSplitterNew( int argc, char * argv[] ) +int otbImageRegionTileMapSplitterNew(int argc, char * argv[]) { const int Dimension = 2; - typedef otb::ImageRegionTileMapSplitter< Dimension > FilterType; + typedef otb::ImageRegionTileMapSplitter<Dimension> FilterType; FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbImageToImageListFilterNew.cxx b/Testing/Code/Common/otbImageToImageListFilterNew.cxx index 11bd5aadf0..ec05821808 100644 --- a/Testing/Code/Common/otbImageToImageListFilterNew.cxx +++ b/Testing/Code/Common/otbImageToImageListFilterNew.cxx @@ -23,15 +23,14 @@ int otbImageToImageListFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageToImageListFilter<InputImageType,OutputImageType> ImageToImageListFilterType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageToImageListFilter<InputImageType, OutputImageType> ImageToImageListFilterType; // Instantiating ImageListSource object ImageToImageListFilterType::Pointer imageList = ImageToImageListFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbImageToLineSpatialObjectListNew.cxx b/Testing/Code/Common/otbImageToLineSpatialObjectListNew.cxx index e2a8b15e06..9477766dfb 100644 --- a/Testing/Code/Common/otbImageToLineSpatialObjectListNew.cxx +++ b/Testing/Code/Common/otbImageToLineSpatialObjectListNew.cxx @@ -26,20 +26,16 @@ #include "otbImageToLineSpatialObjectListFilter.h" - -int otbImageToLineSpatialObjectListNew( int argc, char* argv[] ) +int otbImageToLineSpatialObjectListNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; - typedef otb::ImageToLineSpatialObjectListFilter< InputImageType > FilterType; + typedef otb::ImageToLineSpatialObjectListFilter<InputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbImageToPathFilterNew.cxx b/Testing/Code/Common/otbImageToPathFilterNew.cxx index 94fc5d7846..b55ac77ac8 100644 --- a/Testing/Code/Common/otbImageToPathFilterNew.cxx +++ b/Testing/Code/Common/otbImageToPathFilterNew.cxx @@ -23,16 +23,13 @@ int otbImageToPathFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef itk::PolyLineParametricPath< Dimension > PathType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::ImageToPathFilter<ImageType,PathType> ImageToPathFilterType; + typedef otb::ImageToPathFilter<ImageType, PathType> ImageToPathFilterType; ImageToPathFilterType::Pointer pathFilter = ImageToPathFilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbImageToVectorImageCastFilter.cxx b/Testing/Code/Common/otbImageToVectorImageCastFilter.cxx index f69d818f07..e7ebc5b7e0 100644 --- a/Testing/Code/Common/otbImageToVectorImageCastFilter.cxx +++ b/Testing/Code/Common/otbImageToVectorImageCastFilter.cxx @@ -24,17 +24,17 @@ int otbImageToVectorImageCastFilter(int argc, char * argv[]) { - const char * infilename = argv[1]; - const char * outfilename = argv[2]; + const char * infilename = argv[1]; + const char * outfilename = argv[2]; const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; - typedef otb::ImageToVectorImageCastFilter<ImageType,VectorImageType> VectorImageCastFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; + typedef otb::ImageToVectorImageCastFilter<ImageType, VectorImageType> VectorImageCastFilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<VectorImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infilename); @@ -45,6 +45,5 @@ int otbImageToVectorImageCastFilter(int argc, char * argv[]) writer->SetInput(cast->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbImageToVectorImageCastFilterNew.cxx b/Testing/Code/Common/otbImageToVectorImageCastFilterNew.cxx index ea92ee6f2b..a90ff169d2 100644 --- a/Testing/Code/Common/otbImageToVectorImageCastFilterNew.cxx +++ b/Testing/Code/Common/otbImageToVectorImageCastFilterNew.cxx @@ -25,14 +25,13 @@ int otbImageToVectorImageCastFilterNew(int argc, char * argv[]) typedef double PixelType; const unsigned int Dimension = 2; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; - typedef otb::ImageToVectorImageCastFilter<ImageType,VectorImageType> VectorImageCastFilterType; + typedef otb::ImageToVectorImageCastFilter<ImageType, VectorImageType> VectorImageCastFilterType; // Instantiation VectorImageCastFilterType::Pointer caster = VectorImageCastFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbLabelMapSourceNew.cxx b/Testing/Code/Common/otbLabelMapSourceNew.cxx index a5ba9c6c23..2668beeb0d 100644 --- a/Testing/Code/Common/otbLabelMapSourceNew.cxx +++ b/Testing/Code/Common/otbLabelMapSourceNew.cxx @@ -24,16 +24,15 @@ int otbLabelMapSourceNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned short LabelType; - - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - - typedef itk::LabelMap<LabelObjectType> InputLabelMapType; + typedef unsigned short LabelType; + + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + + typedef itk::LabelMap<LabelObjectType> InputLabelMapType; typedef otb::LabelMapSource<InputLabelMapType> LabelMapSourceType; // Instantiating LabelMapSource object LabelMapSourceType::Pointer LabelMap = LabelMapSourceType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbLabelMapToGISTableFilter.cxx b/Testing/Code/Common/otbLabelMapToGISTableFilter.cxx index 81f9c54287..e56fd22c28 100644 --- a/Testing/Code/Common/otbLabelMapToGISTableFilter.cxx +++ b/Testing/Code/Common/otbLabelMapToGISTableFilter.cxx @@ -32,45 +32,44 @@ int otbLabelMapToGISTableFilter(int argc, char * argv[]) { - - if ( argc != 6 ) - { + + if (argc != 6) + { std::cerr << "Usage: " << argv[0]; std::cerr << " inputLabelImageFile dbName tableName userName userPassword" << std::endl; return EXIT_FAILURE; - } - - const char * infname = argv[1]; + } + + const char * infname = argv[1]; const std::string dbName = argv[2]; const std::string tableName = argv[3]; const std::string userName = argv[4]; const std::string userPassword = argv[5]; - + // Labeled image type const unsigned int Dimension = 2; typedef unsigned short LabelType; - typedef otb::Image<LabelType,Dimension> LabeledImageType; + typedef otb::Image<LabelType, Dimension> LabeledImageType; typedef otb::ImageFileReader<LabeledImageType> LabeledReaderType; - + // Label map typedef - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef itk::LabelImageToLabelMapFilter<LabeledImageType,LabelMapType> LabelMapFilterType; - typedef otb::Polygon<double> PolygonType; - typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType,PolygonType> FunctorType; - - typedef otb::PostGISConnectionImplementation BdConnection; + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + typedef itk::LabelImageToLabelMapFilter<LabeledImageType, LabelMapType> LabelMapFilterType; + typedef otb::Polygon<double> PolygonType; + typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType, PolygonType> FunctorType; + + typedef otb::PostGISConnectionImplementation BdConnection; typedef otb::PostGISConnectionImplementation::Pointer BdConnectionPointer; - + BdConnectionPointer myConnection = BdConnection::New(); - myConnection->SetHost( "localhost" ); - myConnection->SetDBName( dbName ); - myConnection->SetUser( userName ); - myConnection->SetPassword( userPassword ); - + myConnection->SetHost("localhost"); + myConnection->SetDBName(dbName); + myConnection->SetUser(userName); + myConnection->SetPassword(userPassword); + typedef otb::PostGISTable<BdConnection, double, 2> PostGISTableType; - - + LabeledReaderType::Pointer lreader = LabeledReaderType::New(); lreader->SetFileName(infname); @@ -79,20 +78,18 @@ int otbLabelMapToGISTableFilter(int argc, char * argv[]) labelMapFilter->SetBackgroundValue(itk::NumericTraits<LabelType>::max()); labelMapFilter->Update(); - - typedef otb::LabelMapToGISTableFilter< LabelMapType , PostGISTableType > LabelMapToGISTableFilterType; + typedef otb::LabelMapToGISTableFilter<LabelMapType, PostGISTableType> LabelMapToGISTableFilterType; LabelMapToGISTableFilterType::Pointer myFilter = LabelMapToGISTableFilterType::New(); - + myFilter->SetInput(labelMapFilter->GetOutput()); - - + myFilter->SetInputGISConnection(myConnection); myFilter->SetGISTableName(tableName); myFilter->SetDropExistingGISTable (true); - + myFilter->Update(); - + return EXIT_SUCCESS; - + } diff --git a/Testing/Code/Common/otbLabelMapToGISTableFilterNew.cxx b/Testing/Code/Common/otbLabelMapToGISTableFilterNew.cxx index 22e368b5ae..9e3a24fa3f 100644 --- a/Testing/Code/Common/otbLabelMapToGISTableFilterNew.cxx +++ b/Testing/Code/Common/otbLabelMapToGISTableFilterNew.cxx @@ -26,18 +26,16 @@ int otbLabelMapToGISTableFilterNew(int argc, char * argv[]) const int Dimension = 2; typedef unsigned char PType; - typedef otb::PostGISConnectionImplementation BdConnection; + typedef otb::PostGISConnectionImplementation BdConnection; typedef otb::GISTable<BdConnection, PType, Dimension> GISTableType; - - typedef itk::AttributeLabelObject< unsigned long, Dimension, double > LabelObjectType; - typedef itk::LabelMap< LabelObjectType > LabelMapType; + typedef itk::AttributeLabelObject<unsigned long, Dimension, double> LabelObjectType; - typedef otb::LabelMapToGISTableFilter< LabelMapType , GISTableType > LabelMapToGISTableFilterType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + + typedef otb::LabelMapToGISTableFilter<LabelMapType, GISTableType> LabelMapToGISTableFilterType; LabelMapToGISTableFilterType::Pointer MyFilter = LabelMapToGISTableFilterType::New(); - + return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbLabelMapToVectorDataFilter.cxx b/Testing/Code/Common/otbLabelMapToVectorDataFilter.cxx index 7764465451..a963fd4274 100644 --- a/Testing/Code/Common/otbLabelMapToVectorDataFilter.cxx +++ b/Testing/Code/Common/otbLabelMapToVectorDataFilter.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "otbImageFileReader.h" #include "otbVectorDataFileWriter.h" #include "otbVectorData.h" @@ -25,7 +24,6 @@ #include <fstream> #include <iostream> - #include "otbImage.h" #include "otbLabelMapToVectorDataFilter.h" #include "otbAttributesMapLabelObject.h" @@ -34,61 +32,60 @@ int otbLabelMapToVectorDataFilter(int argc, char * argv[]) { /** Use the labelObjecttopolygon functor (not thread safe) only polygon conversion is available yet*/ - if ( argc != 3 ) - { + if (argc != 3) + { std::cerr << "Usage: " << argv[0]; std::cerr << " inputImageFile outputVectorfile(shp)" << std::endl; return EXIT_FAILURE; - } - const char * infname = argv[1]; - const char * outfname = argv[2]; - + } + const char * infname = argv[1]; + const char * outfname = argv[2]; + // Labeled image type - const unsigned int Dimension = 2; - typedef unsigned short LabelType; - typedef otb::Image<LabelType,Dimension> LabeledImageType; - typedef otb::ImageFileReader<LabeledImageType> LabeledReaderType; - + const unsigned int Dimension = 2; + typedef unsigned short LabelType; + typedef otb::Image<LabelType, Dimension> LabeledImageType; + typedef otb::ImageFileReader<LabeledImageType> LabeledReaderType; + // Label map typedef - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef itk::LabelImageToLabelMapFilter<LabeledImageType,LabelMapType> LabelMapFilterType; - typedef otb::Polygon<double> PolygonType; - typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType,PolygonType> FunctorType; - typedef otb::VectorData<double,2> VectorDataType; - typedef VectorDataType::DataNodeType DataNodeType; - typedef otb::VectorDataFileWriter<VectorDataType> WriterType; - typedef otb::VectorDataProjectionFilter<VectorDataType,VectorDataType> VectorDataFilterType; - - - LabeledReaderType::Pointer lreader = LabeledReaderType::New(); - lreader->SetFileName(infname); - - LabelMapFilterType::Pointer labelMapFilter = LabelMapFilterType::New(); - labelMapFilter->SetInput(lreader->GetOutput()); - labelMapFilter->SetBackgroundValue(itk::NumericTraits<LabelType>::max()); - labelMapFilter->Update(); - - WriterType::Pointer writer = WriterType::New(); - - typedef otb::LabelMapToVectorDataFilter< LabelMapType , VectorDataType > LabelMapToVectorDataFilterType; - - LabelMapToVectorDataFilterType::Pointer MyFilter = LabelMapToVectorDataFilterType::New(); - - MyFilter->SetInput(labelMapFilter->GetOutput()); - MyFilter->Update(); - - MyFilter->GetOutput()->SetProjectionRef(lreader->GetOutput()->GetProjectionRef()); - - VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); - vectorDataProjection->SetInputOrigin(lreader->GetOutput()->GetOrigin()); - vectorDataProjection->SetInputSpacing(lreader->GetOutput()->GetSpacing()); - vectorDataProjection->SetInput(MyFilter->GetOutput()); - - writer->SetFileName(outfname); - writer->SetInput(vectorDataProjection->GetOutput()); - writer->Update(); - - return EXIT_SUCCESS; - + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + typedef itk::LabelImageToLabelMapFilter<LabeledImageType, LabelMapType> LabelMapFilterType; + typedef otb::Polygon<double> PolygonType; + typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType, PolygonType> FunctorType; + typedef otb::VectorData<double, 2> VectorDataType; + typedef VectorDataType::DataNodeType DataNodeType; + typedef otb::VectorDataFileWriter<VectorDataType> WriterType; + typedef otb::VectorDataProjectionFilter<VectorDataType, VectorDataType> VectorDataFilterType; + + LabeledReaderType::Pointer lreader = LabeledReaderType::New(); + lreader->SetFileName(infname); + + LabelMapFilterType::Pointer labelMapFilter = LabelMapFilterType::New(); + labelMapFilter->SetInput(lreader->GetOutput()); + labelMapFilter->SetBackgroundValue(itk::NumericTraits<LabelType>::max()); + labelMapFilter->Update(); + + WriterType::Pointer writer = WriterType::New(); + + typedef otb::LabelMapToVectorDataFilter<LabelMapType, VectorDataType> LabelMapToVectorDataFilterType; + + LabelMapToVectorDataFilterType::Pointer MyFilter = LabelMapToVectorDataFilterType::New(); + + MyFilter->SetInput(labelMapFilter->GetOutput()); + MyFilter->Update(); + + MyFilter->GetOutput()->SetProjectionRef(lreader->GetOutput()->GetProjectionRef()); + + VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); + vectorDataProjection->SetInputOrigin(lreader->GetOutput()->GetOrigin()); + vectorDataProjection->SetInputSpacing(lreader->GetOutput()->GetSpacing()); + vectorDataProjection->SetInput(MyFilter->GetOutput()); + + writer->SetFileName(outfname); + writer->SetInput(vectorDataProjection->GetOutput()); + writer->Update(); + + return EXIT_SUCCESS; + } diff --git a/Testing/Code/Common/otbLabelMapToVectorDataFilterNew.cxx b/Testing/Code/Common/otbLabelMapToVectorDataFilterNew.cxx index b489390636..0721fae9c0 100644 --- a/Testing/Code/Common/otbLabelMapToVectorDataFilterNew.cxx +++ b/Testing/Code/Common/otbLabelMapToVectorDataFilterNew.cxx @@ -26,16 +26,14 @@ int otbLabelMapToVectorDataFilterNew(int argc, char * argv[]) typedef unsigned char PType; typedef otb::VectorData<> VectorDataType; - - typedef itk::AttributeLabelObject< unsigned long, dim, double > LabelObjectType; - typedef itk::LabelMap< LabelObjectType > LabelMapType; + typedef itk::AttributeLabelObject<unsigned long, dim, double> LabelObjectType; - typedef otb::LabelMapToVectorDataFilter< LabelMapType , VectorDataType > LabelMapToVectorDataFilterType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + + typedef otb::LabelMapToVectorDataFilter<LabelMapType, VectorDataType> LabelMapToVectorDataFilterType; LabelMapToVectorDataFilterType::Pointer MyFilter = LabelMapToVectorDataFilterType::New(); - + return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbLabelObjectMapVectorizer.cxx b/Testing/Code/Common/otbLabelObjectMapVectorizer.cxx index 8a7889492e..2ad883e81a 100644 --- a/Testing/Code/Common/otbLabelObjectMapVectorizer.cxx +++ b/Testing/Code/Common/otbLabelObjectMapVectorizer.cxx @@ -34,35 +34,35 @@ int otbLabelObjectMapVectorizer(int argc, char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; - + // Labeled image type const unsigned int Dimension = 2; typedef unsigned short LabelType; - typedef otb::Image<LabelType,Dimension> LabeledImageType; + typedef otb::Image<LabelType, Dimension> LabeledImageType; typedef otb::ImageFileReader<LabeledImageType> LabeledReaderType; - + // Label map typedef - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef itk::LabelImageToLabelMapFilter<LabeledImageType,LabelMapType> LabelMapFilterType; - typedef otb::Polygon<double> PolygonType; - typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType,PolygonType> FunctorType; - typedef otb::VectorData<double,2> VectorDataType; - typedef VectorDataType::DataNodeType DataNodeType; - typedef otb::VectorDataFileWriter<VectorDataType> WriterType; - typedef otb::VectorDataProjectionFilter<VectorDataType,VectorDataType> VectorDataFilterType; - typedef itk::MinimumMaximumImageCalculator<LabeledImageType> MinMaxCalculatorType; - - typedef otb::CorrectPolygonFunctor <PolygonType> CorrectPolygonFunctorType; - + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + typedef itk::LabelImageToLabelMapFilter<LabeledImageType, LabelMapType> LabelMapFilterType; + typedef otb::Polygon<double> PolygonType; + typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType, PolygonType> FunctorType; + typedef otb::VectorData<double, 2> VectorDataType; + typedef VectorDataType::DataNodeType DataNodeType; + typedef otb::VectorDataFileWriter<VectorDataType> WriterType; + typedef otb::VectorDataProjectionFilter<VectorDataType, VectorDataType> VectorDataFilterType; + typedef itk::MinimumMaximumImageCalculator<LabeledImageType> MinMaxCalculatorType; + + typedef otb::CorrectPolygonFunctor <PolygonType> CorrectPolygonFunctorType; + LabeledReaderType::Pointer lreader = LabeledReaderType::New(); lreader->SetFileName(infname); LabelMapFilterType::Pointer labelMapFilter = LabelMapFilterType::New(); labelMapFilter->SetInput(lreader->GetOutput()); labelMapFilter->SetBackgroundValue(itk::NumericTraits<LabelType>::max()); - std::cout<<"min: " << itk::NumericTraits<LabelType>::min() << std::endl; - std::cout<<"max: " << itk::NumericTraits<LabelType>::max() << std::endl; + std::cout << "min: " << itk::NumericTraits<LabelType>::min() << std::endl; + std::cout << "max: " << itk::NumericTraits<LabelType>::max() << std::endl; //labelMapFilter->SetBackgroundValue(0); labelMapFilter->Update(); @@ -70,39 +70,39 @@ int otbLabelObjectMapVectorizer(int argc, char * argv[]) //correct CorrectPolygonFunctorType correctPolygon; - - WriterType::Pointer writer = WriterType::New(); + + WriterType::Pointer writer = WriterType::New(); VectorDataType::Pointer data = VectorDataType::New(); DataNodeType::Pointer document = DataNodeType::New(); DataNodeType::Pointer folder1 = DataNodeType::New(); - + document->SetNodeType(otb::DOCUMENT); folder1->SetNodeType(otb::FOLDER); - DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get(); + DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get(); - data->GetDataTree()->Add(document,root); - data->GetDataTree()->Add(folder1,document); + data->GetDataTree()->Add(document, root); + data->GetDataTree()->Add(folder1, document); data->SetProjectionRef(lreader->GetOutput()->GetProjectionRef()); itk::TimeProbe chrono; // If a label is given, extract only this label - if(argc == 4) + if (argc == 4) { - std::cout<<"Label is given;Vectorizing object "<<atoi(argv[3]) <<std::endl; + std::cout << "Label is given;Vectorizing object " << atoi(argv[3]) << std::endl; chrono.Start(); PolygonType::Pointer polygon = functor(labelMapFilter->GetOutput()->GetLabelObject(atoi(argv[3]))); chrono.Stop(); - + //correct polygon PolygonType::Pointer correct_polygon = correctPolygon(polygon); - + DataNodeType::Pointer node = DataNodeType::New(); node->SetNodeType(otb::FEATURE_POLYGON); node->SetPolygonExteriorRing(correct_polygon); - data->GetDataTree()->Add(node,folder1); + data->GetDataTree()->Add(node, folder1); } // Else extract all labels else @@ -111,36 +111,35 @@ int otbLabelObjectMapVectorizer(int argc, char * argv[]) minMax->SetImage(lreader->GetOutput()); minMax->Compute(); - - for(LabelType label = minMax->GetMinimum(); label <=minMax->GetMaximum(); ++label) + for (LabelType label = minMax->GetMinimum(); label <= minMax->GetMaximum(); ++label) { - if(labelMapFilter->GetOutput()->HasLabel(label) && label != labelMapFilter->GetOutput()->GetBackgroundValue()) - { - std::cout<<"Vectorizing object "<<label<<std::endl; - chrono.Start(); - PolygonType::Pointer polygon = functor(labelMapFilter->GetOutput()->GetLabelObject(label)); - chrono.Stop(); - + if (labelMapFilter->GetOutput()->HasLabel(label) && label != labelMapFilter->GetOutput()->GetBackgroundValue()) + { + std::cout << "Vectorizing object " << label << std::endl; + chrono.Start(); + PolygonType::Pointer polygon = functor(labelMapFilter->GetOutput()->GetLabelObject(label)); + chrono.Stop(); + //correct polygon PolygonType::Pointer correct_polygon = correctPolygon(polygon); - - DataNodeType::Pointer node = DataNodeType::New(); - node->SetNodeType(otb::FEATURE_POLYGON); + + DataNodeType::Pointer node = DataNodeType::New(); + node->SetNodeType(otb::FEATURE_POLYGON); node->SetPolygonExteriorRing(correct_polygon); - data->GetDataTree()->Add(node,folder1); - } + data->GetDataTree()->Add(node, folder1); + } } } - std::cout<<"Average vectorization time: "<<chrono.GetMeanTime()<<" s."<<std::endl; - - VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); - vectorDataProjection->SetInputOrigin(lreader->GetOutput()->GetOrigin()); - vectorDataProjection->SetInputSpacing(lreader->GetOutput()->GetSpacing()); - vectorDataProjection->SetInput(data); - - writer->SetFileName(outfname); - writer->SetInput(vectorDataProjection->GetOutput()); - writer->Update(); - - return EXIT_SUCCESS; + std::cout << "Average vectorization time: " << chrono.GetMeanTime() << " s." << std::endl; + + VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); + vectorDataProjection->SetInputOrigin(lreader->GetOutput()->GetOrigin()); + vectorDataProjection->SetInputSpacing(lreader->GetOutput()->GetSpacing()); + vectorDataProjection->SetInput(data); + + writer->SetFileName(outfname); + writer->SetInput(vectorDataProjection->GetOutput()); + writer->Update(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbLabelObjectToPolygonFunctorNew.cxx b/Testing/Code/Common/otbLabelObjectToPolygonFunctorNew.cxx index 476fd7c49d..0774442af7 100644 --- a/Testing/Code/Common/otbLabelObjectToPolygonFunctorNew.cxx +++ b/Testing/Code/Common/otbLabelObjectToPolygonFunctorNew.cxx @@ -23,11 +23,11 @@ int otbLabelObjectToPolygonFunctorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned short LabelType; - - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef otb::Polygon<double> PolygonType; - typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType,PolygonType> FunctorType; + typedef unsigned short LabelType; + + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef otb::Polygon<double> PolygonType; + typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType, PolygonType> FunctorType; //typedef FunctorType::Pointer FunctorPointerType; // Instantiation //FunctorPointerType myFunctor = FunctorType::New(); diff --git a/Testing/Code/Common/otbLineSpatialObjectList.cxx b/Testing/Code/Common/otbLineSpatialObjectList.cxx index 380c209ea7..75fc86017d 100644 --- a/Testing/Code/Common/otbLineSpatialObjectList.cxx +++ b/Testing/Code/Common/otbLineSpatialObjectList.cxx @@ -21,31 +21,28 @@ #include "otbLineSpatialObjectList.h" #include <list> -int otbLineSpatialObjectList( int argc, char * argv[] ) +int otbLineSpatialObjectList(int argc, char * argv[]) { - typedef otb::LineSpatialObjectList LineSpatialObjectListType; - typedef LineSpatialObjectListType::LineType LineSpatialObjecType; - typedef LineSpatialObjectListType::LineType::PointListType PointListType; - typedef LineSpatialObjectListType::const_iterator LineSpatialObjectListConstIterator; + typedef otb::LineSpatialObjectList LineSpatialObjectListType; + typedef LineSpatialObjectListType::LineType LineSpatialObjecType; + typedef LineSpatialObjectListType::LineType::PointListType PointListType; + typedef LineSpatialObjectListType::const_iterator LineSpatialObjectListConstIterator; LineSpatialObjectListType::Pointer listLines = LineSpatialObjectListType::New(); - for ( int i = 0; i < 10; i++ ) - { + for (int i = 0; i < 10; i++) + { LineSpatialObjecType::Pointer lLine = LineSpatialObjecType::New(); - listLines->push_back( lLine ); - } + listLines->push_back(lLine); + } LineSpatialObjectListConstIterator lIter; lIter = listLines->begin(); - while ( lIter != listLines->end() ) - { + while (lIter != listLines->end()) + { LineSpatialObjecType::Pointer lLine = (*lIter); - PointListType lPoints = lLine->GetPoints(); + PointListType lPoints = lLine->GetPoints(); lIter++; - } - + } return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbLineSpatialObjectListToPointSetFilterNew.cxx b/Testing/Code/Common/otbLineSpatialObjectListToPointSetFilterNew.cxx index 5263709361..d62694decb 100644 --- a/Testing/Code/Common/otbLineSpatialObjectListToPointSetFilterNew.cxx +++ b/Testing/Code/Common/otbLineSpatialObjectListToPointSetFilterNew.cxx @@ -26,20 +26,16 @@ #include "otbLineSpatialObjectListToPointSetFilter.h" - -int otbLineSpatialObjectListToPointSetFilterNew( int argc, char* argv[] ) +int otbLineSpatialObjectListToPointSetFilterNew(int argc, char* argv[]) { - typedef float InputPixelType; - typedef otb::LineSpatialObjectList LinesListType; - typedef itk::PointSet<InputPixelType> PointSetType; + typedef float InputPixelType; + typedef otb::LineSpatialObjectList LinesListType; + typedef itk::PointSet<InputPixelType> PointSetType; typedef otb::LineSpatialObjectListToPointSetFilter<LinesListType, PointSetType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbLineSpatialObjectNew.cxx b/Testing/Code/Common/otbLineSpatialObjectNew.cxx index eefe8d7846..62cad29d45 100644 --- a/Testing/Code/Common/otbLineSpatialObjectNew.cxx +++ b/Testing/Code/Common/otbLineSpatialObjectNew.cxx @@ -27,6 +27,5 @@ int otbLineSpatialObjectNew(int argc, char * argv[]) // Instantiating object LineSpatialObjectType::Pointer object = LineSpatialObjectType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbMirrorBoundaryConditionTest.cxx b/Testing/Code/Common/otbMirrorBoundaryConditionTest.cxx index 00dee11dff..f6d88f893a 100644 --- a/Testing/Code/Common/otbMirrorBoundaryConditionTest.cxx +++ b/Testing/Code/Common/otbMirrorBoundaryConditionTest.cxx @@ -23,14 +23,14 @@ int otbMirrorBoundaryConditionTest(int argc, char * argv[]) { - typedef otb::VectorImage<double,2> ImageType; + typedef otb::VectorImage<double, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef itk::ConstNeighborhoodIterator<ImageType> NeighborhoodIteratorType; - typedef NeighborhoodIteratorType::RadiusType RadiusType; - typedef otb::MirrorBoundaryCondition<ImageType> ConditionType; - typedef NeighborhoodIteratorType::OffsetType OffsetType; - typedef ImageType::PixelType PixelType; + typedef NeighborhoodIteratorType::RadiusType RadiusType; + typedef otb::MirrorBoundaryCondition<ImageType> ConditionType; + typedef NeighborhoodIteratorType::OffsetType OffsetType; + typedef ImageType::PixelType PixelType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -41,65 +41,67 @@ int otbMirrorBoundaryConditionTest(int argc, char * argv[]) ConditionType nbc; - NeighborhoodIteratorType it(rad,reader->GetOutput(),reader->GetOutput()->GetLargestPossibleRegion()); - it.OverrideBoundaryCondition( &nbc ); + NeighborhoodIteratorType it(rad, reader->GetOutput(), reader->GetOutput()->GetLargestPossibleRegion()); + it.OverrideBoundaryCondition(&nbc); it.GoToBegin(); - OffsetType off1,off2; + OffsetType off1, off2; itk::OStringStream oss; - PixelType in,out; - for (unsigned int i = 1;i<=rad[0];++i) - { - for (unsigned int j = 1;j<=rad[1];++j) + PixelType in, out; + for (unsigned int i = 1; i <= rad[0]; ++i) { + for (unsigned int j = 1; j <= rad[1]; ++j) + { off1[0] = -static_cast<int>(i); off1[1] = -static_cast<int>(j); off2[0] = i; off2[1] = j; - out=it.GetPixel(off1); + out = it.GetPixel(off1); in = it.GetPixel(off2); - for (unsigned int band = 0;band<reader->GetOutput()->GetNumberOfComponentsPerPixel();++band) - { + for (unsigned int band = 0; band < reader->GetOutput()->GetNumberOfComponentsPerPixel(); ++band) + { oss.str(""); - oss<<"Band "<<band<<" : OutOfBound offset: "<<off1<<" <-> value: "<<out[band]<<" != inside image offset: "<<off2<<" <-> value: "<<in[band]; - otbControlConditionTestMacro(out[band]!=in[band],oss.str().c_str()); + oss << "Band " << band << " : OutOfBound offset: " << off1 << " <-> value: " << out[band] << + " != inside image offset: " << off2 << " <-> value: " << in[band]; + otbControlConditionTestMacro(out[band] != in[band], oss.str().c_str()); + } } } - } - ImageType::IndexType center; - center[0]=reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/2; - center[1]=reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/2; + center[0] = reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0] / 2; + center[1] = reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1] / 2; it.SetLocation(center); bool resp = true; - for (unsigned int i = 0;i<rad[0];++i) - { - for (unsigned int j = 0;j<rad[1];++j) + for (unsigned int i = 0; i < rad[0]; ++i) { + for (unsigned int j = 0; j < rad[1]; ++j) + { off1[0] = -static_cast<int>(i); off1[1] = -static_cast<int>(j); off2[0] = i; off2[1] = j; - out=it.GetPixel(off1); + out = it.GetPixel(off1); in = it.GetPixel(off2); - for (unsigned int band = 0;band<reader->GetOutput()->GetNumberOfComponentsPerPixel();++band) - { - resp = resp && (out[band]==in[band]); + for (unsigned int band = 0; band < reader->GetOutput()->GetNumberOfComponentsPerPixel(); ++band) + { + resp = resp && (out[band] == in[band]); + } } } - } - otbControlConditionTestMacro(resp,"All symmetrical value of the iterator are equal in the center of the image. their might be a problem."); + otbControlConditionTestMacro( + resp, + "All symmetrical value of the iterator are equal in the center of the image. their might be a problem."); return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbMultiChannelExtractROI.cxx b/Testing/Code/Common/otbMultiChannelExtractROI.cxx index b4cbc277bd..a76d665ddf 100644 --- a/Testing/Code/Common/otbMultiChannelExtractROI.cxx +++ b/Testing/Code/Common/otbMultiChannelExtractROI.cxx @@ -22,175 +22,205 @@ #include "otbImageFileWriter.h" #include "otbMultiChannelExtractROI.h" - #include "otbImage.h" - -template < typename InputPixelType /*= unsigned char */, typename OutputPixelType /*= unsigned char*/ > -int generic_otbMultiChannelExtractROI( int argc, char * argv[], const char * inputFilename,const char * outputFilename) +template <typename InputPixelType /*= unsigned char */, typename OutputPixelType /*= unsigned char*/> +int generic_otbMultiChannelExtractROI(int argc, char * argv[], const char * inputFilename, const char * outputFilename) { - typedef otb::MultiChannelExtractROI< InputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::MultiChannelExtractROI<InputPixelType, + OutputPixelType> ExtractROIFilterType; typename ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - int cpt(0),nbcanaux(0); + int cpt(0), nbcanaux(0); - while ( argv[cpt] != NULL ) - { - std::string strArgv(argv[cpt]); - if ( strArgv == "-startX" ) + while (argv[cpt] != NULL) { - extractROIFilter->SetStartX((unsigned long)::atoi(argv[cpt+1])); - std::cout <<" ->SetStartX("<<::atoi(argv[cpt+1])<<")"<<std::endl; + std::string strArgv(argv[cpt]); + if (strArgv == "-startX") + { + extractROIFilter->SetStartX((unsigned long) ::atoi(argv[cpt + 1])); + std::cout << " ->SetStartX(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; - } - else if ( strArgv == "-startY" ) - { - extractROIFilter->SetStartY((unsigned long)::atoi(argv[cpt+1])); - std::cout <<" ->SetStartY("<<::atoi(argv[cpt+1])<<")"<<std::endl; + } + else if (strArgv == "-startY") + { + extractROIFilter->SetStartY((unsigned long) ::atoi(argv[cpt + 1])); + std::cout << " ->SetStartY(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; - } - else if ( strArgv == "-sizeX" ) - { - extractROIFilter->SetSizeX((unsigned long)::atoi(argv[cpt+1])); - std::cout <<" ->SetSizeX("<<::atoi(argv[cpt+1])<<")"<<std::endl; + } + else if (strArgv == "-sizeX") + { + extractROIFilter->SetSizeX((unsigned long) ::atoi(argv[cpt + 1])); + std::cout << " ->SetSizeX(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; - } - else if ( strArgv == "-sizeY" ) - { - extractROIFilter->SetSizeY((unsigned long)::atoi(argv[cpt+1])); - std::cout <<" ->SetSizeY("<<::atoi(argv[cpt+1])<<")"<<std::endl; + } + else if (strArgv == "-sizeY") + { + extractROIFilter->SetSizeY((unsigned long) ::atoi(argv[cpt + 1])); + std::cout << " ->SetSizeY(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; - } - else if ( strArgv == "-channels" ) - { + } + else if (strArgv == "-channels") + { cpt++; bool searchChannels(true); - while (searchChannels==true) - { - if ( argv[cpt] == NULL ) + while (searchChannels == true) { + if (argv[cpt] == NULL) + { searchChannels = false; - } + } else - //Regarde si ce n'est pas une autre otption - { - if ( argv[cpt][0] == '-' ) + //Regarde si ce n'est pas une autre otption { + if (argv[cpt][0] == '-') + { searchChannels = false; - } + } else - { - extractROIFilter->SetChannel((unsigned int)::atoi(argv[cpt]) ); - std::cout <<" ->SetChannel("<<::atoi(argv[cpt])<<")"<<std::endl; + { + extractROIFilter->SetChannel((unsigned int) ::atoi(argv[cpt])); + std::cout << " ->SetChannel(" << ::atoi(argv[cpt]) << ")" << std::endl; cpt++; nbcanaux++; + } } } } } - } // Resume de la ligne de commande - std::cout << " ROI selectionnee : startX "<<extractROIFilter->GetStartX()<<std::endl; - std::cout << " startY "<<extractROIFilter->GetStartY()<<std::endl; - std::cout << " sizeX "<<extractROIFilter->GetSizeX()<<std::endl; - std::cout << " sizeY "<<extractROIFilter->GetSizeY()<<std::endl; - std::cout << " Canaux selectionnes ("<<extractROIFilter->GetNbChannels()<<") : "; + std::cout << " ROI selectionnee : startX " << extractROIFilter->GetStartX() << std::endl; + std::cout << " startY " << extractROIFilter->GetStartY() << std::endl; + std::cout << " sizeX " << extractROIFilter->GetSizeX() << std::endl; + std::cout << " sizeY " << extractROIFilter->GetSizeY() << std::endl; + std::cout << " Canaux selectionnes (" << extractROIFilter->GetNbChannels() << ") : "; typename ExtractROIFilterType::ChannelsType lChannels; lChannels = extractROIFilter->GetChannels(); - for (unsigned int i=0; i< lChannels.size(); i++) - { - std::cout << lChannels[i]<<" "; - } + for (unsigned int i = 0; i < lChannels.size(); i++) + { + std::cout << lChannels[i] << " "; + } - std::cout << " Extraction de "<<nbcanaux<<" de l'image source."<<std::endl; + std::cout << " Extraction de " << nbcanaux << " de l'image source." << std::endl; // OTB-FA-00008-CS - typedef otb::ImageFileReader< ITK_TYPENAME ExtractROIFilterType::InputImageType > ReaderType; - typedef otb::ImageFileWriter< ITK_TYPENAME ExtractROIFilterType::OutputImageType > WriterType; + typedef otb::ImageFileReader<ITK_TYPENAME ExtractROIFilterType::InputImageType> ReaderType; + typedef otb::ImageFileWriter<ITK_TYPENAME ExtractROIFilterType::OutputImageType> WriterType; typename ReaderType::Pointer reader = ReaderType::New(); typename WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); //THOMAS // reader->Update(); //Necessaire pour connaitre le nombre de canaux dans l'image - writer->SetFileName( outputFilename ); - extractROIFilter->SetInput( reader->GetOutput() ); + writer->SetFileName(outputFilename); + extractROIFilter->SetInput(reader->GetOutput()); - writer->SetInput( extractROIFilter->GetOutput() ); + writer->SetInput(extractROIFilter->GetOutput()); writer->Update(); - std::cout << " Nb canaux dans l'image d'entree : "<< reader->GetOutput()->GetNumberOfComponentsPerPixel()<<std::endl; - std::cout << " Nb canaux dans l'image de sortie : "<<extractROIFilter->GetOutput()->GetNumberOfComponentsPerPixel() <<std::endl; - + std::cout << " Nb canaux dans l'image d'entree : " << reader->GetOutput()->GetNumberOfComponentsPerPixel() << + std::endl; + std::cout << " Nb canaux dans l'image de sortie : " << + extractROIFilter->GetOutput()->GetNumberOfComponentsPerPixel() << std::endl; return EXIT_SUCCESS; } - -int otbMultiChannelExtractROI ( int argc, char * argv[] ) +int otbMultiChannelExtractROI(int argc, char * argv[]) { - std::string linputPixelType; - std::string loutputPixelType; + std::string linputPixelType; + std::string loutputPixelType; const char * inputFilename; const char * outputFilename; - int cpt(1); + int cpt(1); //Si le format n'est pas sp�cif�, alors celui par defaut - if ( argv[cpt][0] == '-' ) - { + if (argv[cpt][0] == '-') + { linputPixelType = std::string(argv[cpt]); cpt++; inputFilename = argv[cpt]; cpt++; - } + } else - { + { linputPixelType = std::string("-uchar"); inputFilename = argv[cpt]; cpt++; - } - if ( argv[cpt][0] == '-' ) - { + } + if (argv[cpt][0] == '-') + { loutputPixelType = std::string(argv[cpt]); cpt++; outputFilename = argv[cpt]; cpt++; - } + } else - { + { loutputPixelType = std::string("-uchar"); outputFilename = argv[cpt]; cpt++; - } + } argc -= cpt; argv += cpt; - std::cout << " -> "<<linputPixelType<<" pour "<<inputFilename<<std::endl; - std::cout << " -> "<<loutputPixelType<<" pour "<<outputFilename<<std::endl; + std::cout << " -> " << linputPixelType << " pour " << inputFilename << std::endl; + std::cout << " -> " << loutputPixelType << " pour " << outputFilename << std::endl; std::string pixelType; - if ( (linputPixelType=="-uchar")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiChannelExtractROI< unsigned char, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-char")&&(loutputPixelType=="-char") ) return (generic_otbMultiChannelExtractROI< char, char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-ushort")&&(loutputPixelType=="-ushort") ) return (generic_otbMultiChannelExtractROI< unsigned short, unsigned short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-uint")&&(loutputPixelType=="-uint") ) return (generic_otbMultiChannelExtractROI< unsigned int, unsigned int >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-float")&&(loutputPixelType=="-float") ) return (generic_otbMultiChannelExtractROI<float, float >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-double")&&(loutputPixelType=="-double") ) return (generic_otbMultiChannelExtractROI<double, double >( argc,argv,inputFilename,outputFilename) ); + if ((linputPixelType == "-uchar") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiChannelExtractROI<unsigned char, unsigned char>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-char") && + (loutputPixelType == + "-char")) return (generic_otbMultiChannelExtractROI<char, char>(argc, argv, inputFilename, outputFilename)); + else if ((linputPixelType == "-ushort") && + (loutputPixelType == + "-ushort")) return (generic_otbMultiChannelExtractROI<unsigned short, unsigned short>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-uint") && + (loutputPixelType == + "-uint")) return (generic_otbMultiChannelExtractROI<unsigned int, unsigned int>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-float") && + (loutputPixelType == + "-float")) return (generic_otbMultiChannelExtractROI<float, float>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-double") && + (loutputPixelType == + "-double")) return (generic_otbMultiChannelExtractROI<double, double>(argc, argv, inputFilename, + outputFilename)); // Type -> uchar - else if ( (linputPixelType=="-ushort")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiChannelExtractROI< unsigned short, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-uint")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiChannelExtractROI< unsigned int, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-float")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiChannelExtractROI< float, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-double")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiChannelExtractROI< double, unsigned char >( argc,argv,inputFilename,outputFilename) ); + else if ((linputPixelType == "-ushort") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiChannelExtractROI<unsigned short, unsigned char>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-uint") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiChannelExtractROI<unsigned int, unsigned char>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-float") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiChannelExtractROI<float, unsigned char>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-double") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiChannelExtractROI<double, unsigned char>(argc, argv, inputFilename, + outputFilename)); // uchar -> Type - else if ( (linputPixelType=="-uchar")&&(loutputPixelType=="-double") ) return (generic_otbMultiChannelExtractROI< unsigned char, double >( argc,argv,inputFilename,outputFilename) ); + else if ((linputPixelType == "-uchar") && + (loutputPixelType == + "-double")) return (generic_otbMultiChannelExtractROI<unsigned char, double>(argc, argv, inputFilename, + outputFilename)); else - { - std::cout << " Erreur : le format des images en entree est mal precise dans la ligne de commande !!!"<<std::endl; - std::cout << " valeurs autorisees : -uchar, -char, -ushort, -uint, -float, -double"<<std::endl; - std::cout << " valeurs par defaut : -uchar"<<std::endl; + { + std::cout << " Erreur : le format des images en entree est mal precise dans la ligne de commande !!!" << std::endl; + std::cout << " valeurs autorisees : -uchar, -char, -ushort, -uint, -float, -double" << std::endl; + std::cout << " valeurs par defaut : -uchar" << std::endl; return EXIT_FAILURE; - } + } return EXIT_FAILURE; } - - diff --git a/Testing/Code/Common/otbMultiChannelExtractROINew.cxx b/Testing/Code/Common/otbMultiChannelExtractROINew.cxx index c0a6b16c18..17027ad72c 100644 --- a/Testing/Code/Common/otbMultiChannelExtractROINew.cxx +++ b/Testing/Code/Common/otbMultiChannelExtractROINew.cxx @@ -19,22 +19,18 @@ #include "itkExceptionObject.h" #include "otbMultiChannelExtractROI.h" - -int otbMultiChannelExtractROINew ( int argc, char * argv[] ) +int otbMultiChannelExtractROINew(int argc, char * argv[]) { // typedef unsigned char InputPixelType; // typedef unsigned char OutputPixelType; - typedef std::complex<float> InputPixelType; - typedef std::complex<double> OutputPixelType; - - typedef otb::MultiChannelExtractROI< InputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef std::complex<float> InputPixelType; + typedef std::complex<double> OutputPixelType; + typedef otb::MultiChannelExtractROI<InputPixelType, + OutputPixelType> ExtractROIFilterType; ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx b/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx index 5b783931cc..02c7f26f70 100644 --- a/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx +++ b/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx @@ -22,170 +22,288 @@ #include "otbImageFileWriter.h" #include "otbMultiToMonoChannelExtractROI.h" -template < typename InputPixelType, typename OutputPixelType > -int generic_otbMultiToMonoChannelExtractROI ( int argc, char * argv[], const char * inputFilename,const char * outputFilename) +template <typename InputPixelType, typename OutputPixelType> +int generic_otbMultiToMonoChannelExtractROI(int argc, + char * argv[], + const char * inputFilename, + const char * outputFilename) { - typedef otb::MultiToMonoChannelExtractROI< InputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::MultiToMonoChannelExtractROI<InputPixelType, + OutputPixelType> ExtractROIFilterType; typename ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); int cpt(0); - while ( argv[cpt] != NULL ) - { - std::string strArgv(argv[cpt]); - if ( strArgv == "-startX" ) + while (argv[cpt] != NULL) { - extractROIFilter->SetStartX((unsigned long)::atoi(argv[cpt+1])); - std::cout <<" ->SetStartX("<<::atoi(argv[cpt+1])<<")"<<std::endl; + std::string strArgv(argv[cpt]); + if (strArgv == "-startX") + { + extractROIFilter->SetStartX((unsigned long) ::atoi(argv[cpt + 1])); + std::cout << " ->SetStartX(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; - } - else if ( strArgv == "-startY" ) - { - extractROIFilter->SetStartY((unsigned long)::atoi(argv[cpt+1])); - std::cout <<" ->SetStartY("<<::atoi(argv[cpt+1])<<")"<<std::endl; + } + else if (strArgv == "-startY") + { + extractROIFilter->SetStartY((unsigned long) ::atoi(argv[cpt + 1])); + std::cout << " ->SetStartY(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; - } - else if ( strArgv == "-sizeX" ) - { - extractROIFilter->SetSizeX((unsigned long)::atoi(argv[cpt+1])); - std::cout <<" ->SetSizeX("<<::atoi(argv[cpt+1])<<")"<<std::endl; + } + else if (strArgv == "-sizeX") + { + extractROIFilter->SetSizeX((unsigned long) ::atoi(argv[cpt + 1])); + std::cout << " ->SetSizeX(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; - } - else if ( strArgv == "-sizeY" ) - { - extractROIFilter->SetSizeY((unsigned long)::atoi(argv[cpt+1])); - std::cout <<" ->SetSizeY("<<::atoi(argv[cpt+1])<<")"<<std::endl; + } + else if (strArgv == "-sizeY") + { + extractROIFilter->SetSizeY((unsigned long) ::atoi(argv[cpt + 1])); + std::cout << " ->SetSizeY(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; - } - else if ( strArgv == "-channel" ) - { - extractROIFilter->SetChannel((unsigned int)::atoi(argv[cpt+1])); - std::cout <<" ->SetChannel("<<::atoi(argv[cpt+1])<<")"<<std::endl; + } + else if (strArgv == "-channel") + { + extractROIFilter->SetChannel((unsigned int) ::atoi(argv[cpt + 1])); + std::cout << " ->SetChannel(" << ::atoi(argv[cpt + 1]) << ")" << std::endl; cpt += 2; + } } - } // Resume de la ligne de commande - std::cout << " ROI selectionnee : startX "<<extractROIFilter->GetStartX()<<std::endl; - std::cout << " startY "<<extractROIFilter->GetStartY()<<std::endl; - std::cout << " sizeX "<<extractROIFilter->GetSizeX()<<std::endl; - std::cout << " sizeY "<<extractROIFilter->GetSizeY()<<std::endl; - std::cout << " Canal selectionne : ("<<extractROIFilter->GetChannel()<<") : "; + std::cout << " ROI selectionnee : startX " << extractROIFilter->GetStartX() << std::endl; + std::cout << " startY " << extractROIFilter->GetStartY() << std::endl; + std::cout << " sizeX " << extractROIFilter->GetSizeX() << std::endl; + std::cout << " sizeY " << extractROIFilter->GetSizeY() << std::endl; + std::cout << " Canal selectionne : (" << extractROIFilter->GetChannel() << ") : "; // OTB-FA-00008-CS // typedef otb::ImageFileReader< typename ExtractROIFilterType::InputImageType, itk::DefaultConvertPixelTraits< InputPixelType > > ReaderType; - typedef otb::ImageFileReader< ITK_TYPENAME ExtractROIFilterType::InputImageType > ReaderType; - typedef otb::ImageFileWriter< ITK_TYPENAME ExtractROIFilterType::OutputImageType > WriterType; + typedef otb::ImageFileReader<ITK_TYPENAME ExtractROIFilterType::InputImageType> ReaderType; + typedef otb::ImageFileWriter<ITK_TYPENAME ExtractROIFilterType::OutputImageType> WriterType; typename ReaderType::Pointer reader = ReaderType::New(); typename WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); //THOMAS // reader->Update(); //Necessaire pour connaitre le nombre de canaux dans l'image - writer->SetFileName( outputFilename ); - extractROIFilter->SetInput( reader->GetOutput() ); + writer->SetFileName(outputFilename); + extractROIFilter->SetInput(reader->GetOutput()); - writer->SetInput( extractROIFilter->GetOutput() ); + writer->SetInput(extractROIFilter->GetOutput()); writer->Update(); - std::cout << " Nb canaux dans l'image d'entree : "<< reader->GetOutput()->GetNumberOfComponentsPerPixel()<<std::endl; - std::cout << " Nb canaux dans l'image de sortie : "<<extractROIFilter->GetOutput()->GetNumberOfComponentsPerPixel() <<std::endl; - + std::cout << " Nb canaux dans l'image d'entree : " << reader->GetOutput()->GetNumberOfComponentsPerPixel() << + std::endl; + std::cout << " Nb canaux dans l'image de sortie : " << + extractROIFilter->GetOutput()->GetNumberOfComponentsPerPixel() << std::endl; return EXIT_SUCCESS; } -int otbMultiToMonoChannelExtractROI ( int argc, char * argv[] ) +int otbMultiToMonoChannelExtractROI(int argc, char * argv[]) { - std::string linputPixelType; - std::string loutputPixelType; + std::string linputPixelType; + std::string loutputPixelType; const char * inputFilename; const char * outputFilename; - int cpt(1); + int cpt(1); //Si le format n'est pas spécifé, alors celui par defaut - if ( argv[cpt][0] == '-' ) - { + if (argv[cpt][0] == '-') + { linputPixelType = std::string(argv[cpt]); cpt++; inputFilename = argv[cpt]; cpt++; - } + } else - { + { linputPixelType = std::string("-uchar"); inputFilename = argv[cpt]; cpt++; - } - if ( argv[cpt][0] == '-' ) - { + } + if (argv[cpt][0] == '-') + { loutputPixelType = std::string(argv[cpt]); cpt++; outputFilename = argv[cpt]; cpt++; - } + } else - { + { loutputPixelType = std::string("-uchar"); outputFilename = argv[cpt]; cpt++; - } + } argc -= cpt; argv += cpt; - std::cout << " -> "<<linputPixelType<<" pour "<<inputFilename<<std::endl; - std::cout << " -> "<<loutputPixelType<<" pour "<<outputFilename<<std::endl; + std::cout << " -> " << linputPixelType << " pour " << inputFilename << std::endl; + std::cout << " -> " << loutputPixelType << " pour " << outputFilename << std::endl; std::string pixelType; - if ( (linputPixelType=="-uchar")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned char, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-short")&&(loutputPixelType=="-short") ) return (generic_otbMultiToMonoChannelExtractROI< short, short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-ushort")&&(loutputPixelType=="-ushort") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned short, unsigned short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-int")&&(loutputPixelType=="-int") ) return (generic_otbMultiToMonoChannelExtractROI< int, int >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-uint")&&(loutputPixelType=="-uint") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned int, unsigned int >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-float")&&(loutputPixelType=="-float") ) return (generic_otbMultiToMonoChannelExtractROI<float, float >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-double")&&(loutputPixelType=="-double") ) return (generic_otbMultiToMonoChannelExtractROI<double, double >( argc,argv,inputFilename,outputFilename) ); + if ((linputPixelType == "-uchar") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiToMonoChannelExtractROI<unsigned char, unsigned char>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-short") && + (loutputPixelType == + "-short")) return (generic_otbMultiToMonoChannelExtractROI<short, short>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-ushort") && + (loutputPixelType == + "-ushort")) return (generic_otbMultiToMonoChannelExtractROI<unsigned short, unsigned short>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-int") && + (loutputPixelType == + "-int")) return (generic_otbMultiToMonoChannelExtractROI<int, int>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-uint") && + (loutputPixelType == + "-uint")) return (generic_otbMultiToMonoChannelExtractROI<unsigned int, unsigned int>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-float") && + (loutputPixelType == + "-float")) return (generic_otbMultiToMonoChannelExtractROI<float, float>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-double") && + (loutputPixelType == + "-double")) return (generic_otbMultiToMonoChannelExtractROI<double, double>(argc, argv, inputFilename, + outputFilename)); // Type -> uchar - else if ( (linputPixelType=="-short")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiToMonoChannelExtractROI< short, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-ushort")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned short, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-int")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiToMonoChannelExtractROI< int, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-uint")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned int, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-float")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiToMonoChannelExtractROI< float, unsigned char >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-double")&&(loutputPixelType=="-uchar") ) return (generic_otbMultiToMonoChannelExtractROI< double, unsigned char >( argc,argv,inputFilename,outputFilename) ); + else if ((linputPixelType == "-short") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiToMonoChannelExtractROI<short, unsigned char>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-ushort") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiToMonoChannelExtractROI<unsigned short, unsigned char>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-int") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiToMonoChannelExtractROI<int, unsigned char>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-uint") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiToMonoChannelExtractROI<unsigned int, unsigned char>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-float") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiToMonoChannelExtractROI<float, unsigned char>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-double") && + (loutputPixelType == + "-uchar")) return (generic_otbMultiToMonoChannelExtractROI<double, unsigned char>(argc, argv, inputFilename, + outputFilename)); // Type -> ushort - else if ( (linputPixelType=="-uchar")&&(loutputPixelType=="-ushort") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned char, unsigned short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-int")&&(loutputPixelType=="-ushort") ) return (generic_otbMultiToMonoChannelExtractROI< int, unsigned short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-uint")&&(loutputPixelType=="-ushort") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned int, unsigned short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-float")&&(loutputPixelType=="-ushort") ) return (generic_otbMultiToMonoChannelExtractROI< float, unsigned short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-double")&&(loutputPixelType=="-ushort") ) return (generic_otbMultiToMonoChannelExtractROI< double, unsigned short >( argc,argv,inputFilename,outputFilename) ); + else if ((linputPixelType == "-uchar") && + (loutputPixelType == + "-ushort")) return (generic_otbMultiToMonoChannelExtractROI<unsigned char, unsigned short>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-int") && + (loutputPixelType == + "-ushort")) return (generic_otbMultiToMonoChannelExtractROI<int, unsigned short>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-uint") && + (loutputPixelType == + "-ushort")) return (generic_otbMultiToMonoChannelExtractROI<unsigned int, unsigned short>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-float") && + (loutputPixelType == + "-ushort")) return (generic_otbMultiToMonoChannelExtractROI<float, unsigned short>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-double") && + (loutputPixelType == + "-ushort")) return (generic_otbMultiToMonoChannelExtractROI<double, unsigned short>(argc, argv, + inputFilename, + outputFilename)); // Type -> ushort - else if ( (linputPixelType=="-uchar")&&(loutputPixelType=="-short") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned char, short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-int")&&(loutputPixelType=="-short") ) return (generic_otbMultiToMonoChannelExtractROI< int, short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-uint")&&(loutputPixelType=="-short") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned int, short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-float")&&(loutputPixelType=="-short") ) return (generic_otbMultiToMonoChannelExtractROI< float, short >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-double")&&(loutputPixelType=="-short") ) return (generic_otbMultiToMonoChannelExtractROI< double, short >( argc,argv,inputFilename,outputFilename) ); + else if ((linputPixelType == "-uchar") && + (loutputPixelType == + "-short")) return (generic_otbMultiToMonoChannelExtractROI<unsigned char, short>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-int") && + (loutputPixelType == + "-short")) return (generic_otbMultiToMonoChannelExtractROI<int, short>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-uint") && + (loutputPixelType == + "-short")) return (generic_otbMultiToMonoChannelExtractROI<unsigned int, short>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-float") && + (loutputPixelType == + "-short")) return (generic_otbMultiToMonoChannelExtractROI<float, short>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-double") && + (loutputPixelType == + "-short")) return (generic_otbMultiToMonoChannelExtractROI<double, short>(argc, argv, inputFilename, + outputFilename)); // Type -> int - else if ( (linputPixelType=="-uchar")&&(loutputPixelType=="-int") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned char, int >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-short")&&(loutputPixelType=="-int") ) return (generic_otbMultiToMonoChannelExtractROI< short, int >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-ushort")&&(loutputPixelType=="-int") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned short, int >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-uint")&&(loutputPixelType=="-int") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned int, int >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-float")&&(loutputPixelType=="-int") ) return (generic_otbMultiToMonoChannelExtractROI< float, int >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-double")&&(loutputPixelType=="-int") ) return (generic_otbMultiToMonoChannelExtractROI< double, int >( argc,argv,inputFilename,outputFilename) ); + else if ((linputPixelType == "-uchar") && + (loutputPixelType == + "-int")) return (generic_otbMultiToMonoChannelExtractROI<unsigned char, int>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-short") && + (loutputPixelType == + "-int")) return (generic_otbMultiToMonoChannelExtractROI<short, int>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-ushort") && + (loutputPixelType == + "-int")) return (generic_otbMultiToMonoChannelExtractROI<unsigned short, int>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-uint") && + (loutputPixelType == + "-int")) return (generic_otbMultiToMonoChannelExtractROI<unsigned int, int>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-float") && + (loutputPixelType == + "-int")) return (generic_otbMultiToMonoChannelExtractROI<float, int>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-double") && + (loutputPixelType == + "-int")) return (generic_otbMultiToMonoChannelExtractROI<double, int>(argc, argv, inputFilename, + outputFilename)); // Type -> double - else if ( (linputPixelType=="-uchar")&&(loutputPixelType=="-double") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned char, double >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-short")&&(loutputPixelType=="-double") ) return (generic_otbMultiToMonoChannelExtractROI< short, double >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-ushort")&&(loutputPixelType=="-double") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned short, double >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-int")&&(loutputPixelType=="-double") ) return (generic_otbMultiToMonoChannelExtractROI< int, double >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-uint")&&(loutputPixelType=="-double") ) return (generic_otbMultiToMonoChannelExtractROI< unsigned int, double >( argc,argv,inputFilename,outputFilename) ); - else if ( (linputPixelType=="-float")&&(loutputPixelType=="-double") ) return (generic_otbMultiToMonoChannelExtractROI< float, double >( argc,argv,inputFilename,outputFilename) ); + else if ((linputPixelType == "-uchar") && + (loutputPixelType == + "-double")) return (generic_otbMultiToMonoChannelExtractROI<unsigned char, double>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-short") && + (loutputPixelType == + "-double")) return (generic_otbMultiToMonoChannelExtractROI<short, double>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-ushort") && + (loutputPixelType == + "-double")) return (generic_otbMultiToMonoChannelExtractROI<unsigned short, double>(argc, argv, + inputFilename, + outputFilename)); + else if ((linputPixelType == "-int") && + (loutputPixelType == + "-double")) return (generic_otbMultiToMonoChannelExtractROI<int, double>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-uint") && + (loutputPixelType == + "-double")) return (generic_otbMultiToMonoChannelExtractROI<unsigned int, double>(argc, argv, inputFilename, + outputFilename)); + else if ((linputPixelType == "-float") && + (loutputPixelType == + "-double")) return (generic_otbMultiToMonoChannelExtractROI<float, double>(argc, argv, inputFilename, + outputFilename)); else - { - std::cout << " Erreur : le format des images en entrée est mal précisé dans la ligne de commande !!!"<<std::endl; - std::cout << " valeurs autorisées : -uchar, -ushort, -uint, -float, -double"<<std::endl; - std::cout << " valeurs par defaut : -uchar"<<std::endl; + { + std::cout << " Erreur : le format des images en entrée est mal précisé dans la ligne de commande !!!" << std::endl; + std::cout << " valeurs autorisées : -uchar, -ushort, -uint, -float, -double" << std::endl; + std::cout << " valeurs par defaut : -uchar" << std::endl; return EXIT_FAILURE; - } + } return EXIT_FAILURE; } - - diff --git a/Testing/Code/Common/otbMultiToMonoChannelExtractROINew.cxx b/Testing/Code/Common/otbMultiToMonoChannelExtractROINew.cxx index 6e81f92a23..38c5b0403f 100644 --- a/Testing/Code/Common/otbMultiToMonoChannelExtractROINew.cxx +++ b/Testing/Code/Common/otbMultiToMonoChannelExtractROINew.cxx @@ -19,22 +19,19 @@ #include "itkExceptionObject.h" #include "otbMultiToMonoChannelExtractROI.h" -int otbMultiToMonoChannelExtractROINew ( int argc, char * argv[] ) +int otbMultiToMonoChannelExtractROINew(int argc, char * argv[]) { // typedef unsigned char InputPixelType; // typedef unsigned char OutputPixelType; - typedef std::complex<float> InputPixelType; - typedef std::complex<double> OutputPixelType; + typedef std::complex<float> InputPixelType; + typedef std::complex<double> OutputPixelType; - typedef otb::MultiToMonoChannelExtractROI< InputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::MultiToMonoChannelExtractROI<InputPixelType, + OutputPixelType> ExtractROIFilterType; ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbObjectList.cxx b/Testing/Code/Common/otbObjectList.cxx index b29bba3e4c..ade922b770 100644 --- a/Testing/Code/Common/otbObjectList.cxx +++ b/Testing/Code/Common/otbObjectList.cxx @@ -24,15 +24,15 @@ int otbObjectList(int argc, char * argv[]) { - const char * inputFilename1 = argv[1]; - const char * inputFilename2 = argv[2]; - const char * inputFilename3 = argv[3]; + const char * inputFilename1 = argv[1]; + const char * inputFilename2 = argv[2]; + const char * inputFilename3 = argv[3]; const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ObjectList<InputImageType> ImageListType; + typedef unsigned char InputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ObjectList<InputImageType> ImageListType; // Reading image 1 ReaderType::Pointer reader1 = ReaderType::New(); @@ -55,117 +55,122 @@ int otbObjectList(int argc, char * argv[]) // Testing reserve/capacity imageList->Reserve(2); - otbControlConditionTestMacro((imageList->Capacity()!=2),"Reserve/Capacity()"); + otbControlConditionTestMacro((imageList->Capacity() != 2), "Reserve/Capacity()"); // Testing Size/Element accessor imageList->PushBack(reader1->GetOutput()); imageList->PushBack(reader2->GetOutput()); - otbControlConditionTestMacro(imageList->Size()!=2,"PushBack/Size()"); - otbControlConditionTestMacro(imageList->GetNthElement(0)!=reader1->GetOutput(),"PushBack/GetNthElement(0)"); - otbControlConditionTestMacro(imageList->GetNthElement(1)!=reader2->GetOutput(),"PushBack/GetNthElement(1)"); - otbControlConditionTestMacro(imageList->Front()!=reader1->GetOutput(),"PushBack/Front()"); - otbControlConditionTestMacro(imageList->Back()!=reader2->GetOutput(),"PushBack/Back()"); + otbControlConditionTestMacro(imageList->Size() != 2, "PushBack/Size()"); + otbControlConditionTestMacro(imageList->GetNthElement(0) != reader1->GetOutput(), "PushBack/GetNthElement(0)"); + otbControlConditionTestMacro(imageList->GetNthElement(1) != reader2->GetOutput(), "PushBack/GetNthElement(1)"); + otbControlConditionTestMacro(imageList->Front() != reader1->GetOutput(), "PushBack/Front()"); + otbControlConditionTestMacro(imageList->Back() != reader2->GetOutput(), "PushBack/Back()"); // Testing resizing and related method imageList->Resize(3); - otbControlConditionTestMacro(imageList->Size()!=3,"Resize/Size()"); + otbControlConditionTestMacro(imageList->Size() != 3, "Resize/Size()"); // Testing explicit setter - imageList->SetNthElement(2,reader3->GetOutput()); + imageList->SetNthElement(2, reader3->GetOutput()); - otbControlConditionTestMacro(imageList->Size()!=3,"SetNthElement/Size()"); - otbControlConditionTestMacro(imageList->GetNthElement(2)!=reader3->GetOutput(),"SetNthElement/GetNthElement(2)"); + otbControlConditionTestMacro(imageList->Size() != 3, "SetNthElement/Size()"); + otbControlConditionTestMacro(imageList->GetNthElement(2) != reader3->GetOutput(), "SetNthElement/GetNthElement(2)"); // Testing erase operation imageList->Erase(2); - otbControlConditionTestMacro((imageList->Size()!=2) - ||(imageList->GetNthElement(0)!=reader1->GetOutput()) - ||(imageList->GetNthElement(1)!=reader2->GetOutput()),"Erase(3)"); + otbControlConditionTestMacro((imageList->Size() != 2) + || (imageList->GetNthElement(0) != reader1->GetOutput()) + || (imageList->GetNthElement(1) != reader2->GetOutput()), "Erase(3)"); // Testing iterator ImageListType::Iterator iter = imageList->Begin(); - otbControlConditionTestMacro(!(iter!=imageList->End()),"Iterator/Begin()!=Iterator/End()"); + otbControlConditionTestMacro(!(iter != imageList->End()), "Iterator/Begin()!=Iterator/End()"); unsigned int index = 0; - while (iter!=imageList->End()) - { - otbControlConditionTestMacro((index==0)&&(reader1->GetOutput()!=iter.Get()),"Iterator/1/iter.Get()"); - otbControlConditionTestMacro((index==1)&&(reader2->GetOutput()!=iter.Get()),"Iterator/2/iter.Get()"); - otbControlConditionTestMacro(index>1,"Iterator/OutOfBound/iter.Get()"); + while (iter != imageList->End()) + { + otbControlConditionTestMacro((index == 0) && (reader1->GetOutput() != iter.Get()), "Iterator/1/iter.Get()"); + otbControlConditionTestMacro((index == 1) && (reader2->GetOutput() != iter.Get()), "Iterator/2/iter.Get()"); + otbControlConditionTestMacro(index > 1, "Iterator/OutOfBound/iter.Get()"); ++index; ++iter; - } + } // Testing operator+ iter = imageList->Begin(); - index=0; + index = 0; otbControlConditionTestMacro(imageList->GetNthElement(0) != iter.Get(), "Iterator != GetNthElement(0)"); - otbControlConditionTestMacro(imageList->GetNthElement(1) != (iter+1).Get(), + otbControlConditionTestMacro(imageList->GetNthElement(1) != (iter + 1).Get(), "Iterator+1 != GetNthElement(1)"); ++iter; otbControlConditionTestMacro(imageList->GetNthElement(1) != iter.Get(), "Iterator != GetNthElement(1)"); - otbControlConditionTestMacro(imageList->GetNthElement(0) != (iter-1).Get(), + otbControlConditionTestMacro(imageList->GetNthElement(0) != (iter - 1).Get(), "Iterator-1 != GetNthElement(0)"); // Testing const iterator ImageListType::ConstIterator constIter = imageList->Begin(); index = 0; - while (constIter!=imageList->End()) - { - otbControlConditionTestMacro((index==0)&&(reader1->GetOutput()!=constIter.Get()),"ConstIterator/1/iter.Get()"); - otbControlConditionTestMacro((index==1)&&(reader2->GetOutput()!=constIter.Get()),"ConstIterator/2/iter.Get()"); - otbControlConditionTestMacro(index>1,"ConstIterator/OutOfBound/iter.Get()"); + while (constIter != imageList->End()) + { + otbControlConditionTestMacro( + (index == 0) && (reader1->GetOutput() != constIter.Get()), "ConstIterator/1/iter.Get()"); + otbControlConditionTestMacro( + (index == 1) && (reader2->GetOutput() != constIter.Get()), "ConstIterator/2/iter.Get()"); + otbControlConditionTestMacro(index > 1, "ConstIterator/OutOfBound/iter.Get()"); ++index; ++constIter; - } + } //Testing reverse iterator ImageListType::ReverseIterator revIter = imageList->ReverseBegin(); - otbControlConditionTestMacro(!(revIter!=imageList->ReverseEnd()),"ReverseIterator/ReverseBegin()!=ReverseIterator/ReverseEnd()"); + otbControlConditionTestMacro( + !(revIter != imageList->ReverseEnd()), "ReverseIterator/ReverseBegin()!=ReverseIterator/ReverseEnd()"); index = 0; - while (revIter!=imageList->ReverseEnd()) - { - otbControlConditionTestMacro((index==0)&&(reader2->GetOutput()!=revIter.Get()),"ReverseIterator/1/iter.Get()"); - otbControlConditionTestMacro((index==1)&&(reader1->GetOutput()!=revIter.Get()),"ReverseIterator/2/iter.Get()"); - otbControlConditionTestMacro(index>1,"ReverseIterator/OutOfBound/iter.Get()"); + while (revIter != imageList->ReverseEnd()) + { + otbControlConditionTestMacro( + (index == 0) && (reader2->GetOutput() != revIter.Get()), "ReverseIterator/1/iter.Get()"); + otbControlConditionTestMacro( + (index == 1) && (reader1->GetOutput() != revIter.Get()), "ReverseIterator/2/iter.Get()"); + otbControlConditionTestMacro(index > 1, "ReverseIterator/OutOfBound/iter.Get()"); ++index; ++revIter; - } + } //Testing const reverse iterator ImageListType::ReverseConstIterator revConstIter = imageList->ReverseBegin(); index = 0; - while (revConstIter!=imageList->ReverseEnd()) - { - otbControlConditionTestMacro((index==0)&&(reader2->GetOutput()!=revConstIter.Get()),"ReverseConstIterator/1/iter.Get()"); - otbControlConditionTestMacro((index==1)&&(reader1->GetOutput()!=revConstIter.Get()),"ReverseConstIterator/2/iter.Get()"); - otbControlConditionTestMacro(index>1,"ReverseConstIterator/OutOfBound/iter.Get()"); + while (revConstIter != imageList->ReverseEnd()) + { + otbControlConditionTestMacro( + (index == 0) && (reader2->GetOutput() != revConstIter.Get()), "ReverseConstIterator/1/iter.Get()"); + otbControlConditionTestMacro( + (index == 1) && (reader1->GetOutput() != revConstIter.Get()), "ReverseConstIterator/2/iter.Get()"); + otbControlConditionTestMacro(index > 1, "ReverseConstIterator/OutOfBound/iter.Get()"); ++index; ++revConstIter; - } + } // Testing clear imageList->Clear(); - otbControlConditionTestMacro(imageList->Size()!=0,"Clear()"); + otbControlConditionTestMacro(imageList->Size() != 0, "Clear()"); // Testing erase with iterators imageList->PushBack(reader1->GetOutput()); imageList->PushBack(reader2->GetOutput()); imageList->PushBack(reader3->GetOutput()); - ImageListType::Iterator begin = imageList->Begin()+1; + ImageListType::Iterator begin = imageList->Begin() + 1; ImageListType::Iterator end = imageList->End(); - imageList->Erase(begin,end); - - otbControlConditionTestMacro(imageList->Size()!=1,"Erase(Iterator,Iterator)/Size()"); - otbControlConditionTestMacro(imageList->Back()!=reader1->GetOutput(),"Erase(Iterator,Iterator)/Back()"); + imageList->Erase(begin, end); + otbControlConditionTestMacro(imageList->Size() != 1, "Erase(Iterator,Iterator)/Size()"); + otbControlConditionTestMacro(imageList->Back() != reader1->GetOutput(), "Erase(Iterator,Iterator)/Back()"); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Common/otbObjectList2.cxx b/Testing/Code/Common/otbObjectList2.cxx index e665cde702..781f0442bf 100644 --- a/Testing/Code/Common/otbObjectList2.cxx +++ b/Testing/Code/Common/otbObjectList2.cxx @@ -25,33 +25,32 @@ int otbObjectList2(int argc, char * argv[]) { - typedef otb::Polygon<double> PolygonType; + typedef otb::Polygon<double> PolygonType; typedef otb::ObjectList<PolygonType> PolygonListType; - PolygonType::Pointer polygon = PolygonType::New(); + PolygonType::Pointer polygon = PolygonType::New(); PolygonListType::Pointer listPolygon = PolygonListType::New(); - otbTestingCheckNotValidCommand( listPolygon->Erase(1) ); - otbTestingCheckValidCommand( listPolygon->Clear() ); - otbTestingCheckNotValidCommand( listPolygon->SetNthElement(0,polygon) ); - otbTestingCheckNotValidCommand( listPolygon->SetNthElement(2,polygon) ); - otbTestingCheckNotValidCommand( listPolygon->GetNthElement(2)); + otbTestingCheckNotValidCommand(listPolygon->Erase(1)); + otbTestingCheckValidCommand(listPolygon->Clear()); + otbTestingCheckNotValidCommand(listPolygon->SetNthElement(0, polygon)); + otbTestingCheckNotValidCommand(listPolygon->SetNthElement(2, polygon)); + otbTestingCheckNotValidCommand(listPolygon->GetNthElement(2)); std::vector<int> tab; tab.reserve(3); - otbControlConditionTestMacro( tab.capacity()!=3,"Check std::vector Capacity"); - otbControlConditionTestMacro( tab.size()!=0,"Check std::vector Size"); + otbControlConditionTestMacro(tab.capacity() != 3, "Check std::vector Capacity"); + otbControlConditionTestMacro(tab.size() != 0, "Check std::vector Size"); tab.resize(2); - otbControlConditionTestMacro( tab.capacity()!=3,"Check std::vector Capacity"); - otbControlConditionTestMacro( tab.size()!=2,"Check std::vector Size"); + otbControlConditionTestMacro(tab.capacity() != 3, "Check std::vector Capacity"); + otbControlConditionTestMacro(tab.size() != 2, "Check std::vector Size"); listPolygon->Reserve(3); - otbControlConditionTestMacro(listPolygon->Capacity()!=3,"Check Reserve and Capacity coherence"); + otbControlConditionTestMacro(listPolygon->Capacity() != 3, "Check Reserve and Capacity coherence"); listPolygon->Resize(2); - otbControlConditionTestMacro(listPolygon->Size()!=2,"Check Resize and Size coherence"); + otbControlConditionTestMacro(listPolygon->Size() != 2, "Check Resize and Size coherence"); - otbTestingCheckValidCommand( listPolygon->SetNthElement(0,polygon) ); - otbTestingCheckNotValidCommand( listPolygon->SetNthElement(2,polygon) ); + otbTestingCheckValidCommand(listPolygon->SetNthElement(0, polygon)); + otbTestingCheckNotValidCommand(listPolygon->SetNthElement(2, polygon)); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Common/otbObjectListNew.cxx b/Testing/Code/Common/otbObjectListNew.cxx index c77e114d70..4c7f8e2763 100644 --- a/Testing/Code/Common/otbObjectListNew.cxx +++ b/Testing/Code/Common/otbObjectListNew.cxx @@ -22,14 +22,11 @@ int otbObjectListNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; + typedef unsigned char PixelType; typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ObjectList<ImageType> ImageListType; + typedef otb::ObjectList<ImageType> ImageListType; ImageListType::Pointer imageList = ImageListType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbObjectListToObjectListFilterNew.cxx b/Testing/Code/Common/otbObjectListToObjectListFilterNew.cxx index 2225e367fb..3ced444b06 100644 --- a/Testing/Code/Common/otbObjectListToObjectListFilterNew.cxx +++ b/Testing/Code/Common/otbObjectListToObjectListFilterNew.cxx @@ -24,18 +24,15 @@ int otbObjectListToObjectListFilterNew(int argc, char * argv[]) { - typedef otb::PolyLineParametricPathWithValue<std::complex<int>,2> InputObjectType; - typedef otb::Polygon<unsigned char> OutputObjectType; + typedef otb::PolyLineParametricPathWithValue<std::complex<int>, 2> InputObjectType; + typedef otb::Polygon<unsigned char> OutputObjectType; - typedef otb::ObjectList<InputObjectType> InputListType; + typedef otb::ObjectList<InputObjectType> InputListType; typedef otb::ObjectList<OutputObjectType> OutputListType; - typedef otb::ObjectListToObjectListFilter<InputListType,OutputListType> ObjectListFilterType; + typedef otb::ObjectListToObjectListFilter<InputListType, OutputListType> ObjectListFilterType; ObjectListFilterType::Pointer objectList = ObjectListFilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbPathListToHistogramGenerator.cxx b/Testing/Code/Common/otbPathListToHistogramGenerator.cxx index 15e4365e99..8c64f05246 100644 --- a/Testing/Code/Common/otbPathListToHistogramGenerator.cxx +++ b/Testing/Code/Common/otbPathListToHistogramGenerator.cxx @@ -26,71 +26,69 @@ #include "otbPathListToHistogramGenerator.h" #include "otbMath.h" -int otbPathListToHistogramGenerator( int argc, char* argv[] ) +int otbPathListToHistogramGenerator(int argc, char* argv[]) { - unsigned int NbOfBins((unsigned int)::atoi(argv[1])); - unsigned int NbOfPointsPerHistogram((unsigned int)::atoi(argv[2])); - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef PathType::Pointer PathPointer; - typedef std::vector< PathPointer > PathListType; + unsigned int NbOfBins((unsigned int) ::atoi(argv[1])); + unsigned int NbOfPointsPerHistogram((unsigned int) ::atoi(argv[2])); + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef PathType::Pointer PathPointer; + typedef std::vector<PathPointer> PathListType; - typedef otb::OrientationPathFunction<PathType> FunctionType; + typedef otb::OrientationPathFunction<PathType> FunctionType; - typedef otb::PathListToHistogramGenerator< PathType,FunctionType > HistogramGeneratorType; + typedef otb::PathListToHistogramGenerator<PathType, FunctionType> HistogramGeneratorType; PathType::ContinuousIndexType cindex; - int NbAngle = NbOfPointsPerHistogram*NbOfBins; + int NbAngle = NbOfPointsPerHistogram * NbOfBins; /* build segments list */ - PathListType* PathList = new PathListType; + PathListType* PathList = new PathListType; PathList->clear(); - for (int i = 0; i <NbAngle; i++) - { + for (int i = 0; i < NbAngle; i++) + { PathPointer pathElt = PathType::New(); pathElt->Initialize(); - cindex[0]=30; - cindex[1]=30; + cindex[0] = 30; + cindex[1] = 30; pathElt->AddVertex(cindex); - float Theta = 2.0*static_cast<float>(otb::CONST_PI)*static_cast<float>(i)/static_cast<float>(NbAngle); - cindex[0]= 30 + vcl_cos(Theta); - cindex[1]= 30 + vcl_sin(Theta); + float Theta = 2.0 * static_cast<float>(otb::CONST_PI) * static_cast<float>(i) / static_cast<float>(NbAngle); + cindex[0] = 30 + vcl_cos(Theta); + cindex[1] = 30 + vcl_sin(Theta); pathElt->AddVertex(cindex); PathList->push_back(pathElt); - } + } HistogramGeneratorType::Pointer histogramGenerator = HistogramGeneratorType::New(); - typedef HistogramGeneratorType::SizeType HistogramSizeType; + typedef HistogramGeneratorType::SizeType HistogramSizeType; HistogramSizeType hsize; hsize[0] = NbOfBins; // number of bins for the Red channel - histogramGenerator->SetInput( PathList ); - histogramGenerator->SetNumberOfBins( hsize ); + histogramGenerator->SetInput(PathList); + histogramGenerator->SetNumberOfBins(hsize); histogramGenerator->Compute(); - typedef HistogramGeneratorType::HistogramType HistogramType; + typedef HistogramGeneratorType::HistogramType HistogramType; const HistogramType * histogram = histogramGenerator->GetOutput(); const unsigned int histogramSize = histogram->Size(); std::cout << "Histogram size " << histogramSize << std::endl; - - for ( unsigned int bin=0; bin < histogramSize; bin++ ) - { - if (histogram->GetFrequency( bin, 0 ) !=NbOfPointsPerHistogram) + for (unsigned int bin = 0; bin < histogramSize; bin++) { + if (histogram->GetFrequency(bin, 0) != NbOfPointsPerHistogram) + { std::cout << "Error in histogram value !" << std::endl; return EXIT_FAILURE; - } + } std::cout << "bin = " << bin << " frequency = "; - std::cout << histogram->GetFrequency( bin, 0 ) << std::endl; - } - + std::cout << histogram->GetFrequency(bin, 0) << std::endl; + } return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbPathListToHistogramGeneratorNew.cxx b/Testing/Code/Common/otbPathListToHistogramGeneratorNew.cxx index d311fd8a0b..1924709432 100644 --- a/Testing/Code/Common/otbPathListToHistogramGeneratorNew.cxx +++ b/Testing/Code/Common/otbPathListToHistogramGeneratorNew.cxx @@ -25,16 +25,15 @@ #include "otbOrientationPathFunction.h" #include "otbPathListToHistogramGenerator.h" -int otbPathListToHistogramGeneratorNew( int argc, char* argv[] ) +int otbPathListToHistogramGeneratorNew(int argc, char* argv[]) { - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::OrientationPathFunction<PathType> FunctionType; + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::OrientationPathFunction<PathType> FunctionType; - typedef otb::PathListToHistogramGenerator< PathType,FunctionType > GeneratorType; + typedef otb::PathListToHistogramGenerator<PathType, FunctionType> GeneratorType; GeneratorType::Pointer histogram = GeneratorType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbPathListToPathListFilterNew.cxx b/Testing/Code/Common/otbPathListToPathListFilterNew.cxx index 067a494229..1447cb006d 100644 --- a/Testing/Code/Common/otbPathListToPathListFilterNew.cxx +++ b/Testing/Code/Common/otbPathListToPathListFilterNew.cxx @@ -24,12 +24,11 @@ int otbPathListToPathListFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::PathListToPathListFilter<PathType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbPointSetSourceTest.cxx b/Testing/Code/Common/otbPointSetSourceTest.cxx index 0c81977231..b6a16219e6 100644 --- a/Testing/Code/Common/otbPointSetSourceTest.cxx +++ b/Testing/Code/Common/otbPointSetSourceTest.cxx @@ -24,8 +24,7 @@ #include "otbPointSetSource.h" #include "itkExceptionObject.h" - -int otbPointSetSourceTest(int argc, char* argv[] ) +int otbPointSetSourceTest(int argc, char* argv[]) { // Declare the PointSet pixel type. // Those are the values associated @@ -33,45 +32,45 @@ int otbPointSetSourceTest(int argc, char* argv[] ) typedef int PixelType; // Declare the types of the PointSet - typedef itk::PointSet<PixelType,2> PointSetType; + typedef itk::PointSet<PixelType, 2> PointSetType; // Declare the type for PointsContainer - typedef PointSetType::PointsContainer PointsContainerType; + typedef PointSetType::PointsContainer PointsContainerType; // Declare the type for PointsContainerPointer typedef PointSetType::PointsContainerPointer PointsContainerPointer; // Declare the type for Points - typedef PointSetType::PointType PointType; + typedef PointSetType::PointType PointType; // Create an input Point Set PointSetType::Pointer inputPointSet = PointSetType::New(); // Insert data on the PointSet - PointsContainerPointer points = inputPointSet->GetPoints(); + PointsContainerPointer points = inputPointSet->GetPoints(); // Fill a square with points , just to get some data - int n = 1; // let's start with a few of them - PointsContainerType::ElementIdentifier count = 0; // count them + int n = 1; // let's start with a few of them + PointsContainerType::ElementIdentifier count = 0; // count them - for (int x= -n; x <= n; x++) - { - for (int y= -n; y <= n; y++) + for (int x = -n; x <= n; x++) { + for (int y = -n; y <= n; y++) + { PointType p; p[0] = x; p[1] = y; std::cout << "Inserting point # "; - std::cout.width( 3); + std::cout.width(3); std::cout << count << " = "; - std::cout.width( 4); + std::cout.width(4); std::cout << p[0] << ", "; - std::cout.width( 4); + std::cout.width(4); std::cout << p[1] << std::endl; - points->InsertElement( count, p ); + points->InsertElement(count, p); count++; + } } - } std::cout << "Input PointSet has " << inputPointSet->GetNumberOfPoints(); std::cout << " points " << std::endl; @@ -81,5 +80,3 @@ int otbPointSetSourceTest(int argc, char* argv[] ) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbPolyLineImageConstIterator.cxx b/Testing/Code/Common/otbPolyLineImageConstIterator.cxx index 8c96555d1e..783bcd4bba 100644 --- a/Testing/Code/Common/otbPolyLineImageConstIterator.cxx +++ b/Testing/Code/Common/otbPolyLineImageConstIterator.cxx @@ -24,26 +24,25 @@ int otbPolyLineImageConstIterator(int argc, char * argv[]) { - if (argc!=5) - { - std::cout<<"Usgage: "<<argv[0]<<" sizex sizey nbpoints outfname"<<std::endl; + if (argc != 5) + { + std::cout << "Usgage: " << argv[0] << " sizex sizey nbpoints outfname" << std::endl; return EXIT_SUCCESS; - } + } const unsigned int sizex = atoi(argv[1]); const unsigned int sizey = atoi(argv[2]); const unsigned int nbpoints = atoi(argv[3]); - const char * outfname = argv[4]; + const char * outfname = argv[4]; const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef PathType::VertexType VertexType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef PathType::VertexType VertexType; typedef otb::PolyLineImageIterator<ImageType, PathType> IteratorType; typedef otb::PolyLineImageConstIterator<ImageType, PathType> ConstIteratorType; - ImageType::SizeType size; size[0] = sizex; size[1] = sizey; @@ -59,37 +58,37 @@ int otbPolyLineImageConstIterator(int argc, char * argv[]) PathType::Pointer path = PathType::New(); - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=0; - vertex1[1]=i*sizey/nbpoints; - vertex2[0]=i*sizex/nbpoints; - vertex2[1]=0; + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = 0; + vertex1[1] = i * sizey / nbpoints; + vertex2[0] = i * sizex / nbpoints; + vertex2[1] = 0; path->AddVertex(vertex1); path->AddVertex(vertex2); - } - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=i*sizex/nbpoints; - vertex1[1]=sizey-1; - vertex2[0]=sizex-1; - vertex2[1]=i*sizey/nbpoints; + } + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = i * sizex / nbpoints; + vertex1[1] = sizey - 1; + vertex2[0] = sizex - 1; + vertex2[1] = i * sizey / nbpoints; path->AddVertex(vertex1); path->AddVertex(vertex2); - } + } image->Update(); - ConstIteratorType cit((const ImageType*)image,(const PathType*)path); + ConstIteratorType cit((const ImageType*) image, (const PathType*) path); std::ofstream flux(outfname); - - for (cit.GoToBegin();!cit.IsAtEnd();++cit) - { - flux <<cit.GetIndex()<<std::endl; - } + + for (cit.GoToBegin(); !cit.IsAtEnd(); ++cit) + { + flux << cit.GetIndex() << std::endl; + } flux.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/Common/otbPolyLineImageIterator.cxx b/Testing/Code/Common/otbPolyLineImageIterator.cxx index 8c2dd190a8..956ee55289 100644 --- a/Testing/Code/Common/otbPolyLineImageIterator.cxx +++ b/Testing/Code/Common/otbPolyLineImageIterator.cxx @@ -24,23 +24,23 @@ int otbPolyLineImageIterator(int argc, char * argv[]) { - if (argc!=5) - { - std::cout<<"Usgage: "<<argv[0]<<" sizex sizey nbpoints outfname"<<std::endl; + if (argc != 5) + { + std::cout << "Usgage: " << argv[0] << " sizex sizey nbpoints outfname" << std::endl; return EXIT_SUCCESS; - } + } const unsigned int sizex = atoi(argv[1]); const unsigned int sizey = atoi(argv[2]); const unsigned int nbpoints = atoi(argv[3]); - const char * outfname = argv[4]; + const char * outfname = argv[4]; const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef PathType::VertexType VertexType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef PathType::VertexType VertexType; typedef otb::PolyLineImageIterator<ImageType, PathType> IteratorType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::ImageFileWriter<ImageType> WriterType; ImageType::SizeType size; size[0] = sizex; @@ -57,40 +57,39 @@ int otbPolyLineImageIterator(int argc, char * argv[]) PathType::Pointer path = PathType::New(); - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=0; - vertex1[1]=i*sizey/nbpoints; - vertex2[0]=i*sizex/nbpoints; - vertex2[1]=0; + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = 0; + vertex1[1] = i * sizey / nbpoints; + vertex2[0] = i * sizex / nbpoints; + vertex2[1] = 0; path->AddVertex(vertex1); path->AddVertex(vertex2); - } - for (unsigned int i =1; i<nbpoints;i++) - { - VertexType vertex1,vertex2; - vertex1[0]=i*sizex/nbpoints; - vertex1[1]=sizey-1; - vertex2[0]=sizex-1; - vertex2[1]=i*sizey/nbpoints; + } + for (unsigned int i = 1; i < nbpoints; i++) + { + VertexType vertex1, vertex2; + vertex1[0] = i * sizex / nbpoints; + vertex1[1] = sizey - 1; + vertex2[0] = sizex - 1; + vertex2[1] = i * sizey / nbpoints; path->AddVertex(vertex1); path->AddVertex(vertex2); - } + } - IteratorType it(image,path); + IteratorType it(image, path); - for (it.GoToBegin();!it.IsAtEnd();++it) - { + for (it.GoToBegin(); !it.IsAtEnd(); ++it) + { it.Set(255); // std::cout<<it.GetIndex()<<std::endl; - } + } WriterType::Pointer writer = WriterType::New(); writer->SetInput(image); writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbPolyLineParametricPathWithValueNew.cxx b/Testing/Code/Common/otbPolyLineParametricPathWithValueNew.cxx index fd890198ef..8648ecb0ff 100644 --- a/Testing/Code/Common/otbPolyLineParametricPathWithValueNew.cxx +++ b/Testing/Code/Common/otbPolyLineParametricPathWithValueNew.cxx @@ -23,13 +23,12 @@ int otbPolyLineParametricPathWithValueNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double ValueType; + typedef double ValueType; typedef otb::PolyLineParametricPathWithValue<ValueType, Dimension> PolyLineParametricPathWithValueType; // Instantiating object PolyLineParametricPathWithValueType::Pointer object = PolyLineParametricPathWithValueType::New(); object->SetValue(0); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbPolygon.cxx b/Testing/Code/Common/otbPolygon.cxx index 5b5cea6f07..3be3b049af 100644 --- a/Testing/Code/Common/otbPolygon.cxx +++ b/Testing/Code/Common/otbPolygon.cxx @@ -23,11 +23,10 @@ int otbPolygon(int argc, char * argv[]) { - typedef otb::Polygon<> PolygonType; + typedef otb::Polygon<> PolygonType; typedef PolygonType::ContinuousIndexType ContinuousIndexType; - typedef PolygonType::VertexListType VertexListType; - typedef VertexListType::ConstIterator IteratorType; - + typedef PolygonType::VertexListType VertexListType; + typedef VertexListType::ConstIterator IteratorType; // Instantiating object PolygonType::Pointer polygon1 = PolygonType::New(); @@ -36,112 +35,140 @@ int otbPolygon(int argc, char * argv[]) const char * outfile = argv[1]; // Reading vertices from command line - int cpt = 2; + int cpt = 2; bool first = true; - while ( argv[cpt] != NULL && argv[cpt+1]!= NULL) - { - if (argv[cpt][0]=='n') + while (argv[cpt] != NULL && argv[cpt + 1] != NULL) { + if (argv[cpt][0] == 'n') + { first = false; ++cpt; - } + } else - { + { ContinuousIndexType newVertex; - newVertex[0]=atof(argv[cpt]); - newVertex[1]=atof(argv[cpt+1]); - if (first) - polygon1->AddVertex(newVertex); - else - polygon2->AddVertex(newVertex); + newVertex[0] = atof(argv[cpt]); + newVertex[1] = atof(argv[cpt + 1]); + if (first) polygon1->AddVertex(newVertex); + else polygon2->AddVertex(newVertex); ++cpt; ++cpt; + } } - } - - IteratorType begin1 = polygon1->GetVertexList()->Begin(); - IteratorType end1 = polygon1->GetVertexList()->End(); - IteratorType begin2 = polygon2->GetVertexList()->Begin(); - IteratorType end2 = polygon2->GetVertexList()->End(); - IteratorType it; - ContinuousIndexType current,firstVertex; + IteratorType begin1 = polygon1->GetVertexList()->Begin(); + IteratorType end1 = polygon1->GetVertexList()->End(); + IteratorType begin2 = polygon2->GetVertexList()->Begin(); + IteratorType end2 = polygon2->GetVertexList()->End(); + IteratorType it; + ContinuousIndexType current, firstVertex; std::ofstream file; file.open(outfile); - for (it=begin1;it!=end1;++it) - { - file<<"polygon1->IsInside("<<it.Value()<<") = "<<polygon1->IsInside(it.Value())<<std::endl; - file<<"polygon1->IsOnEdge("<<it.Value()<<") = "<<polygon1->IsOnEdge(it.Value())<<std::endl; - file<<"polygon2->IsInside("<<it.Value()<<") = "<<polygon2->IsInside(it.Value())<<std::endl; - file<<"polygon2->IsOnEdge("<<it.Value()<<") = "<<polygon2->IsOnEdge(it.Value())<<std::endl; - } - file<<std::endl<<std::endl; - for (it=begin2;it!=end2;++it) - { - file<<"polygon1->IsInside("<<it.Value()<<") = "<<polygon1->IsInside(it.Value())<<std::endl; - file<<"polygon1->IsOnEdge("<<it.Value()<<") = "<<polygon1->IsOnEdge(it.Value())<<std::endl; - file<<"polygon2->IsInside("<<it.Value()<<") = "<<polygon2->IsInside(it.Value())<<std::endl; - file<<"polygon2->IsOnEdge("<<it.Value()<<") = "<<polygon2->IsOnEdge(it.Value())<<std::endl; - } - file<<std::endl<<std::endl; + for (it = begin1; it != end1; ++it) + { + file << "polygon1->IsInside(" << it.Value() << ") = " << polygon1->IsInside(it.Value()) << std::endl; + file << "polygon1->IsOnEdge(" << it.Value() << ") = " << polygon1->IsOnEdge(it.Value()) << std::endl; + file << "polygon2->IsInside(" << it.Value() << ") = " << polygon2->IsInside(it.Value()) << std::endl; + file << "polygon2->IsOnEdge(" << it.Value() << ") = " << polygon2->IsOnEdge(it.Value()) << std::endl; + } + file << std::endl << std::endl; + for (it = begin2; it != end2; ++it) + { + file << "polygon1->IsInside(" << it.Value() << ") = " << polygon1->IsInside(it.Value()) << std::endl; + file << "polygon1->IsOnEdge(" << it.Value() << ") = " << polygon1->IsOnEdge(it.Value()) << std::endl; + file << "polygon2->IsInside(" << it.Value() << ") = " << polygon2->IsInside(it.Value()) << std::endl; + file << "polygon2->IsOnEdge(" << it.Value() << ") = " << polygon2->IsOnEdge(it.Value()) << std::endl; + } + file << std::endl << std::endl; current = begin1.Value(); - firstVertex=current; + firstVertex = current; ++begin1; - for (it=begin1;it!=end1;++it) - { - file<<"polygon1->NbCrossing("<<current<<", "<<it.Value()<<") = "<<polygon1->NbCrossing(current,it.Value())<<std::endl; - file<<"polygon1->NbTouching("<<current<<", "<<it.Value()<<") = "<<polygon1->NbTouching(current,it.Value())<<std::endl; - file<<"polygon2->NbCrossing("<<current<<", "<<it.Value()<<") = "<<polygon2->NbCrossing(current,it.Value())<<std::endl; - file<<"polygon2->NbTouching("<<current<<", "<<it.Value()<<") = "<<polygon2->NbTouching(current,it.Value())<<std::endl; + for (it = begin1; it != end1; ++it) + { + file << "polygon1->NbCrossing(" << current << ", " << it.Value() << ") = " << polygon1->NbCrossing(current, + it.Value()) << + std::endl; + file << "polygon1->NbTouching(" << current << ", " << it.Value() << ") = " << polygon1->NbTouching(current, + it.Value()) << + std::endl; + file << "polygon2->NbCrossing(" << current << ", " << it.Value() << ") = " << polygon2->NbCrossing(current, + it.Value()) << + std::endl; + file << "polygon2->NbTouching(" << current << ", " << it.Value() << ") = " << polygon2->NbTouching(current, + it.Value()) << + std::endl; current = it.Value(); - } - file<<"polygon1->NbCrossing("<<current<<", "<<firstVertex<<") = "<<polygon1->NbCrossing(current,firstVertex)<<std::endl; - file<<"polygon1->NbTouching("<<current<<", "<<firstVertex<<") = "<<polygon1->NbTouching(current,firstVertex)<<std::endl; - file<<"polygon2->NbCrossing("<<current<<", "<<firstVertex<<") = "<<polygon2->NbCrossing(current,firstVertex)<<std::endl; - file<<"polygon2->NbTouching("<<current<<", "<<firstVertex<<") = "<<polygon2->NbTouching(current,firstVertex)<<std::endl; - - file<<std::endl<<std::endl; + } + file << "polygon1->NbCrossing(" << current << ", " << firstVertex << ") = " << polygon1->NbCrossing(current, + firstVertex) << + std::endl; + file << "polygon1->NbTouching(" << current << ", " << firstVertex << ") = " << polygon1->NbTouching(current, + firstVertex) << + std::endl; + file << "polygon2->NbCrossing(" << current << ", " << firstVertex << ") = " << polygon2->NbCrossing(current, + firstVertex) << + std::endl; + file << "polygon2->NbTouching(" << current << ", " << firstVertex << ") = " << polygon2->NbTouching(current, + firstVertex) << + std::endl; + + file << std::endl << std::endl; current = begin2.Value(); - firstVertex=current; + firstVertex = current; ++begin2; - for (it=begin2;it!=end2;++it) - { - file<<"polygon1->NbCrossing("<<current<<", "<<it.Value()<<") = "<<polygon1->NbCrossing(current,it.Value())<<std::endl; - file<<"polygon1->NbTouching("<<current<<", "<<it.Value()<<") = "<<polygon1->NbTouching(current,it.Value())<<std::endl; - file<<"polygon2->NbCrossing("<<current<<", "<<it.Value()<<") = "<<polygon2->NbCrossing(current,it.Value())<<std::endl; - file<<"polygon2->NbTouching("<<current<<", "<<it.Value()<<") = "<<polygon2->NbTouching(current,it.Value())<<std::endl; + for (it = begin2; it != end2; ++it) + { + file << "polygon1->NbCrossing(" << current << ", " << it.Value() << ") = " << polygon1->NbCrossing(current, + it.Value()) << + std::endl; + file << "polygon1->NbTouching(" << current << ", " << it.Value() << ") = " << polygon1->NbTouching(current, + it.Value()) << + std::endl; + file << "polygon2->NbCrossing(" << current << ", " << it.Value() << ") = " << polygon2->NbCrossing(current, + it.Value()) << + std::endl; + file << "polygon2->NbTouching(" << current << ", " << it.Value() << ") = " << polygon2->NbTouching(current, + it.Value()) << + std::endl; current = it.Value(); - } - file<<"polygon1->NbCrossing("<<current<<", "<<firstVertex<<") = "<<polygon1->NbCrossing(current,firstVertex)<<std::endl; - file<<"polygon1->NbTouching("<<current<<", "<<firstVertex<<") = "<<polygon1->NbTouching(current,firstVertex)<<std::endl; - file<<"polygon2->NbCrossing("<<current<<", "<<firstVertex<<") = "<<polygon2->NbCrossing(current,firstVertex)<<std::endl; - file<<"polygon2->NbTouching("<<current<<", "<<firstVertex<<") = "<<polygon2->NbTouching(current,firstVertex)<<std::endl; - - file<<std::endl<<std::endl; - file<<"Bounding Boxs computation : "<<std::endl; + } + file << "polygon1->NbCrossing(" << current << ", " << firstVertex << ") = " << polygon1->NbCrossing(current, + firstVertex) << + std::endl; + file << "polygon1->NbTouching(" << current << ", " << firstVertex << ") = " << polygon1->NbTouching(current, + firstVertex) << + std::endl; + file << "polygon2->NbCrossing(" << current << ", " << firstVertex << ") = " << polygon2->NbCrossing(current, + firstVertex) << + std::endl; + file << "polygon2->NbTouching(" << current << ", " << firstVertex << ") = " << polygon2->NbTouching(current, + firstVertex) << + std::endl; + + file << std::endl << std::endl; + file << "Bounding Boxs computation : " << std::endl; PolygonType::RegionType r1 = polygon1->GetBoundingRegion(); - file<<"Bounding Box 1"<<std::endl; - file<<"Index : "<<r1.GetIndex()<<" , Size : "<<r1.GetSize()<<std::endl; + file << "Bounding Box 1" << std::endl; + file << "Index : " << r1.GetIndex() << " , Size : " << r1.GetSize() << std::endl; PolygonType::RegionType r2 = polygon2->GetBoundingRegion(); - file<<"Bounding Box 2"<<std::endl; - file<<"Index : "<<r2.GetIndex()<<" , Size : "<<r2.GetSize()<<std::endl; + file << "Bounding Box 2" << std::endl; + file << "Index : " << r2.GetIndex() << " , Size : " << r2.GetSize() << std::endl; - file<<std::endl<<std::endl; - file<<"Surface computation : "<<std::endl; - file<<"Surface 1 :" << (double) polygon1->GetArea() << std::endl; - file<<"Surface 2 :" << polygon2->GetArea() << std::endl; + file << std::endl << std::endl; + file << "Surface computation : " << std::endl; + file << "Surface 1 :" << (double) polygon1->GetArea() << std::endl; + file << "Surface 2 :" << polygon2->GetArea() << std::endl; - file<<std::endl<<std::endl; - file<<"Length computation : "<<std::endl; - file<<"Length 1 :" << (double) polygon1->GetLength() << std::endl; - file<<"Length 2 :" << polygon2->GetLength() << std::endl; + file << std::endl << std::endl; + file << "Length computation : " << std::endl; + file << "Length 1 :" << (double) polygon1->GetLength() << std::endl; + file << "Length 2 :" << polygon2->GetLength() << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbPolygonNew.cxx b/Testing/Code/Common/otbPolygonNew.cxx index e21f3d849f..cc9d3ebed4 100644 --- a/Testing/Code/Common/otbPolygonNew.cxx +++ b/Testing/Code/Common/otbPolygonNew.cxx @@ -27,6 +27,5 @@ int otbPolygonNew(int argc, char * argv[]) // Instantiating object PolygonType::Pointer polygon = PolygonType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbPostGISConnectionImplementationConnectToDB.cxx b/Testing/Code/Common/otbPostGISConnectionImplementationConnectToDB.cxx index 470649aeeb..8e9c100e78 100644 --- a/Testing/Code/Common/otbPostGISConnectionImplementationConnectToDB.cxx +++ b/Testing/Code/Common/otbPostGISConnectionImplementationConnectToDB.cxx @@ -33,13 +33,12 @@ int otbPostGISConnectionImplementationConnectToDB(int argc, char * argv[]) //Instantiation GISConnectionType::Pointer connection = GISConnectionType::New(); - connection->SetHost( hostName ); - connection->SetDBName( dbName ); - connection->SetUser( userName ); - connection->SetPassword( userPassword ); + connection->SetHost(hostName); + connection->SetDBName(dbName); + connection->SetUser(userName); + connection->SetPassword(userPassword); connection->ConnectToDB(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbPostGISConnectionImplementationPerformTransaction.cxx b/Testing/Code/Common/otbPostGISConnectionImplementationPerformTransaction.cxx index d3cb0eaf89..4e58e41c33 100644 --- a/Testing/Code/Common/otbPostGISConnectionImplementationPerformTransaction.cxx +++ b/Testing/Code/Common/otbPostGISConnectionImplementationPerformTransaction.cxx @@ -25,7 +25,7 @@ class ReadTables : public pqxx::transactor<pqxx::nontransaction> public: ReadTables() : pqxx::transactor<pqxx::nontransaction>("ReadTables") {} - void operator()(argument_type &T) + void operator ()(argument_type& T) { m_Result = T.exec("SELECT * FROM pg_tables"); } @@ -33,12 +33,12 @@ public: void on_commit() { for (pqxx::result::const_iterator c = m_Result.begin(); c != m_Result.end(); ++c) - { + { std::string N; c[0].to(N); std::cout << '\t' << c.num() << '\t' << N << std::endl; - } + } } }; @@ -55,14 +55,14 @@ int otbPostGISConnectionImplementationPerformTransaction(int argc, char * argv[] //Instantiation GISConnectionType::Pointer connection = GISConnectionType::New(); - connection->SetHost( hostName ); - connection->SetDBName( dbName ); - connection->SetUser( userName ); - connection->SetPassword( userPassword ); + connection->SetHost(hostName); + connection->SetDBName(dbName); + connection->SetUser(userName); + connection->SetPassword(userPassword); connection->ConnectToDB(); - connection->GetConnection()->perform( ReadTables() ); + connection->GetConnection()->perform(ReadTables()); return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbQuickLookImageGenerator.cxx b/Testing/Code/Common/otbQuickLookImageGenerator.cxx index 8e778213e0..071f7fd5c6 100644 --- a/Testing/Code/Common/otbQuickLookImageGenerator.cxx +++ b/Testing/Code/Common/otbQuickLookImageGenerator.cxx @@ -40,19 +40,18 @@ int otbQuickLookImageGenerator(int argc, char* argv[]) ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFileName ); - + reader->SetFileName(inputFileName); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); filter->SetSampleRatio(atoi(argv[3])); filter->SetVariance(atof(argv[4])); filter->SetMaximumError(atof(argv[5])); filter->SetMaximumKernelWidth(atoi(argv[6])); filter->UseImageSpacing(atoi(argv[7])); - - writer->SetInput( filter->GetOutput() ); - writer->SetFileName( outputFileName ); - + + writer->SetInput(filter->GetOutput()); + writer->SetFileName(outputFileName); + writer->Update(); return EXIT_SUCCESS; diff --git a/Testing/Code/Common/otbQuickLookImageGeneratorNew.cxx b/Testing/Code/Common/otbQuickLookImageGeneratorNew.cxx index e2cabec120..ec32cd70b0 100644 --- a/Testing/Code/Common/otbQuickLookImageGeneratorNew.cxx +++ b/Testing/Code/Common/otbQuickLookImageGeneratorNew.cxx @@ -24,7 +24,6 @@ #include "otbQuickLookImageGenerator.h" #include "otbVectorImage.h" - int otbQuickLookImageGeneratorNew(int argc, char* argv[]) { typedef otb::VectorImage<double, 2> ImageType; diff --git a/Testing/Code/Common/otbRadiometricAttributesLabelMapFilterNew.cxx b/Testing/Code/Common/otbRadiometricAttributesLabelMapFilterNew.cxx index 4834540fde..728304ba01 100644 --- a/Testing/Code/Common/otbRadiometricAttributesLabelMapFilterNew.cxx +++ b/Testing/Code/Common/otbRadiometricAttributesLabelMapFilterNew.cxx @@ -23,14 +23,14 @@ int otbRadiometricAttributesLabelMapFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned short LabelType; - typedef double PixelType; - - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::RadiometricAttributesLabelMapFilter<LabelMapType,VectorImageType> RadiometricLabelMapFilterType; - + typedef unsigned short LabelType; + typedef double PixelType; + + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::RadiometricAttributesLabelMapFilter<LabelMapType, VectorImageType> RadiometricLabelMapFilterType; + // Instantiation RadiometricLabelMapFilterType::Pointer radiometricLabelMapFilter = RadiometricLabelMapFilterType::New(); diff --git a/Testing/Code/Common/otbRectangle.cxx b/Testing/Code/Common/otbRectangle.cxx index 2d633e3163..387547d3e6 100644 --- a/Testing/Code/Common/otbRectangle.cxx +++ b/Testing/Code/Common/otbRectangle.cxx @@ -22,8 +22,8 @@ int otbRectangle(int argc, char * argv[]) { - const char * outfname = argv[1]; - + const char * outfname = argv[1]; + typedef otb::Rectangle<> RectangleType; typedef RectangleType::ContinuousIndexType ContinuousIndexType; typedef RectangleType::VertexListType VertexListType; @@ -33,40 +33,33 @@ int otbRectangle(int argc, char * argv[]) RectangleType::Pointer rectangle1 = RectangleType::New(); ContinuousIndexType newVertex; - - newVertex[0]=atof(argv[2]); - newVertex[1]=atof(argv[3]); + + newVertex[0] = atof(argv[2]); + newVertex[1] = atof(argv[3]); rectangle1->AddVertex(newVertex); - - newVertex[0]=atof(argv[4]); - newVertex[1]=atof(argv[5]); + + newVertex[0] = atof(argv[4]); + newVertex[1] = atof(argv[5]); rectangle1->AddVertex(newVertex); - + rectangle1->SetWidth(atof(argv[6])); rectangle1->SetOrientation(atof(argv[7])); - /** Inside the rectangle test*/ ContinuousIndexType InsideVertex; InsideVertex[0] = atof(argv[8]); InsideVertex[1] = atof(argv[9]); - std::ofstream outfile(outfname); - if(rectangle1->IsInside(InsideVertex)) - outfile <<"The point " << InsideVertex << " Is Inside the rectangle" << std::endl; - else - outfile <<"The point " << InsideVertex << " Is Outside the rectangle" << std::endl; + if (rectangle1->IsInside(InsideVertex)) outfile << "The point " << InsideVertex << " Is Inside the rectangle" << + std::endl; + else outfile << "The point " << InsideVertex << " Is Outside the rectangle" << std::endl; - - - outfile<< "region Size" << rectangle1->GetBoundingRegion().GetSize()<<std::endl; - outfile<< "region Origin" << rectangle1->GetBoundingRegion().GetIndex()<<std::endl; - + outfile << "region Size" << rectangle1->GetBoundingRegion().GetSize() << std::endl; + outfile << "region Origin" << rectangle1->GetBoundingRegion().GetIndex() << std::endl; outfile.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbRemoteSensingRegion.cxx b/Testing/Code/Common/otbRemoteSensingRegion.cxx index 2abb101e67..222e767c72 100644 --- a/Testing/Code/Common/otbRemoteSensingRegion.cxx +++ b/Testing/Code/Common/otbRemoteSensingRegion.cxx @@ -18,61 +18,51 @@ #include "otbRemoteSensingRegion.h" - int otbRemoteSensingRegion(int argc, char * argv[]) { - typedef double Type; - - const Type startX = atof(argv[1]); - const Type startY = atof(argv[2]); - const Type sizeX = atof(argv[3]); - const Type sizeY = atof(argv[4]); - - const Type pointX = atof(argv[5]); - const Type pointY = atof(argv[6]); - + typedef double Type; - typedef otb::RemoteSensingRegion<Type> TypedRegion; - + const Type startX = atof(argv[1]); + const Type startY = atof(argv[2]); + const Type sizeX = atof(argv[3]); + const Type sizeY = atof(argv[4]); + const Type pointX = atof(argv[5]); + const Type pointY = atof(argv[6]); - TypedRegion region; + typedef otb::RemoteSensingRegion<Type> TypedRegion; - - /** */ - TypedRegion::SizeType size; - TypedRegion::IndexType index, indexPt; + TypedRegion region; + /** */ + TypedRegion::SizeType size; + TypedRegion::IndexType index, indexPt; - size[0] = sizeX; size[1] = sizeY; - + index[0] = startX; index[1] = startY; region.SetSize(size); region.SetOrigin(index); - /** Check if the segment is inside the region*/ indexPt[0] = pointX; indexPt[1] = pointY; - if(region.IsInside(indexPt)) - std::cout << "Le point " << indexPt[0] << "," << indexPt[1]<< " is inside the region " << std::endl; - else - std::cout << "Le point is OUTSIDE the region " << std::endl; - + if (region.IsInside(indexPt)) std::cout << "Le point " << indexPt[0] << "," << indexPt[1] << + " is inside the region " << std::endl; + else std::cout << "Le point is OUTSIDE the region " << std::endl; + /*Set the projection */ - std::string projectionRefWkt ="PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; - + std::string projectionRefWkt = + "PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; + region.SetRegionProjection(projectionRefWkt); - std::cout << "The projection set is " << region.GetRegionProjection()<<std::endl; - + std::cout << "The projection set is " << region.GetRegionProjection() << std::endl; return EXIT_SUCCESS; } - diff --git a/Testing/Code/Common/otbRemoteSensingRegionNew.cxx b/Testing/Code/Common/otbRemoteSensingRegionNew.cxx index 6eac6904c3..799e8f3126 100644 --- a/Testing/Code/Common/otbRemoteSensingRegionNew.cxx +++ b/Testing/Code/Common/otbRemoteSensingRegionNew.cxx @@ -18,15 +18,13 @@ #include "otbRemoteSensingRegion.h" - int otbRemoteSensingRegionNew(int argc, char * argv[]) { - - typedef double Type; - typedef otb::RemoteSensingRegion<Type> TypedRegion; - - TypedRegion Cartoregion; - + + typedef double Type; + typedef otb::RemoteSensingRegion<Type> TypedRegion; + + TypedRegion Cartoregion; + return EXIT_SUCCESS; } - diff --git a/Testing/Code/Common/otbShapeAttributesLabelMapFilterNew.cxx b/Testing/Code/Common/otbShapeAttributesLabelMapFilterNew.cxx index 31963426ef..a4072b8456 100644 --- a/Testing/Code/Common/otbShapeAttributesLabelMapFilterNew.cxx +++ b/Testing/Code/Common/otbShapeAttributesLabelMapFilterNew.cxx @@ -24,12 +24,12 @@ int otbShapeAttributesLabelMapFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned short LabelType; - - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef otb::ShapeAttributesLabelMapFilter<LabelMapType> ShapeLabelMapFilterType; - + typedef unsigned short LabelType; + + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + typedef otb::ShapeAttributesLabelMapFilter<LabelMapType> ShapeLabelMapFilterType; + // Instantiation ShapeLabelMapFilterType::Pointer ShapeLabelMapFilter = ShapeLabelMapFilterType::New(); diff --git a/Testing/Code/Common/otbShiftScaleImageAdaptor.cxx b/Testing/Code/Common/otbShiftScaleImageAdaptor.cxx index 5ab5c29f85..4c1748b33f 100644 --- a/Testing/Code/Common/otbShiftScaleImageAdaptor.cxx +++ b/Testing/Code/Common/otbShiftScaleImageAdaptor.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -24,18 +23,17 @@ #include "itkRescaleIntensityImageFilter.h" #include "otbShiftScaleImageAdaptor.h" - -int otbShiftScaleImageAdaptor( int argc, char * argv[] ) +int otbShiftScaleImageAdaptor(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; typedef double PixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<PixelType, 2> InputImageType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef unsigned char OutputPixelType; + typedef otb::Image<PixelType, 2> InputImageType; + typedef otb::Image<OutputPixelType, 2> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; typedef otb::ShiftScaleImageAdaptor<InputImageType, PixelType> FilterType; typedef itk::RescaleIntensityImageFilter<FilterType, OutputImageType> RescalerType; @@ -47,20 +45,18 @@ int otbShiftScaleImageAdaptor( int argc, char * argv[] ) filter->SetScale(3.); filter->SetShift(10.); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); - filter->SetImage( reader->GetOutput() ); + filter->SetImage(reader->GetOutput()); - rescaler->SetOutputMinimum( 0 ); - rescaler->SetOutputMaximum( 255 ); - rescaler->SetInput( filter ); + rescaler->SetOutputMinimum(0); + rescaler->SetOutputMaximum(255); + rescaler->SetInput(filter); - writer->SetFileName( outputFilename ); - writer->SetInput( rescaler->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetInput(rescaler->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbShiftScaleImageAdaptorNew.cxx b/Testing/Code/Common/otbShiftScaleImageAdaptorNew.cxx index 1882554050..5a4577a4d2 100644 --- a/Testing/Code/Common/otbShiftScaleImageAdaptorNew.cxx +++ b/Testing/Code/Common/otbShiftScaleImageAdaptorNew.cxx @@ -16,21 +16,17 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbVectorImage.h" #include "otbShiftScaleImageAdaptor.h" -int otbShiftScaleImageAdaptorNew( int argc, char * argv[] ) +int otbShiftScaleImageAdaptorNew(int argc, char * argv[]) { - typedef double InputPixelType; - typedef otb::VectorImage<InputPixelType, 2> ImageType; - typedef otb::ShiftScaleImageAdaptor< ImageType, InputPixelType > FilterType; + typedef double InputPixelType; + typedef otb::VectorImage<InputPixelType, 2> ImageType; + typedef otb::ShiftScaleImageAdaptor<ImageType, InputPixelType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbSpatialObjectSourceNew.cxx b/Testing/Code/Common/otbSpatialObjectSourceNew.cxx index 05d6454dcb..a2b044e831 100644 --- a/Testing/Code/Common/otbSpatialObjectSourceNew.cxx +++ b/Testing/Code/Common/otbSpatialObjectSourceNew.cxx @@ -23,12 +23,11 @@ int otbSpatialObjectSourceNew(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef itk::GroupSpatialObject<Dimension> SpatialObjectType; + typedef itk::GroupSpatialObject<Dimension> SpatialObjectType; typedef otb::SpatialObjectSource<SpatialObjectType> SpatialObjectSourceType; // Instantiation SpatialObjectSourceType::Pointer source = SpatialObjectSourceType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbStandardFilterWatcherNew.cxx b/Testing/Code/Common/otbStandardFilterWatcherNew.cxx index a5e6c551e3..274f7c5fa2 100644 --- a/Testing/Code/Common/otbStandardFilterWatcherNew.cxx +++ b/Testing/Code/Common/otbStandardFilterWatcherNew.cxx @@ -25,8 +25,8 @@ int otbStandardFilterWatcherNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); @@ -40,6 +40,5 @@ int otbStandardFilterWatcherNew(int argc, char * argv[]) gradient->SetInput(reader->GetOutput()); gradient->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbStandardWriterWatcher.cxx b/Testing/Code/Common/otbStandardWriterWatcher.cxx index ecb1f4760d..1f4c23e7e9 100644 --- a/Testing/Code/Common/otbStandardWriterWatcher.cxx +++ b/Testing/Code/Common/otbStandardWriterWatcher.cxx @@ -26,17 +26,17 @@ int otbStandardWriterWatcher(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; + const char * infname = argv[1]; + const char * outfname = argv[2]; const unsigned int nbsd = atoi(argv[3]); const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef itk::GradientMagnitudeImageFilter<ImageType, ImageType> FilterType; - typedef otb::StreamingImageFileWriter<ImageType> StreamingWriterType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::StreamingImageFileWriter<ImageType> StreamingWriterType; + typedef otb::ImageFileWriter<ImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); diff --git a/Testing/Code/Common/otbStatisticsAttributesLabelMapFilterNew.cxx b/Testing/Code/Common/otbStatisticsAttributesLabelMapFilterNew.cxx index 5b8e16e93e..3292ad4507 100644 --- a/Testing/Code/Common/otbStatisticsAttributesLabelMapFilterNew.cxx +++ b/Testing/Code/Common/otbStatisticsAttributesLabelMapFilterNew.cxx @@ -23,14 +23,14 @@ int otbStatisticsAttributesLabelMapFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned short LabelType; - typedef double PixelType; - - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::StatisticsAttributesLabelMapFilter<LabelMapType,ImageType> StatisticsLabelMapFilterType; - + typedef unsigned short LabelType; + typedef double PixelType; + + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::StatisticsAttributesLabelMapFilter<LabelMapType, ImageType> StatisticsLabelMapFilterType; + // Instantiation StatisticsLabelMapFilterType::Pointer StatisticsAttributesLabelMapFilter = StatisticsLabelMapFilterType::New(); diff --git a/Testing/Code/Common/otbSystemTest.cxx b/Testing/Code/Common/otbSystemTest.cxx index aab1907efb..349cd41364 100644 --- a/Testing/Code/Common/otbSystemTest.cxx +++ b/Testing/Code/Common/otbSystemTest.cxx @@ -27,11 +27,10 @@ #include "itkMacro.h" #include "otbSystem.h" - -int otbSystemTest( int argc, char* argv[] ) +int otbSystemTest(int argc, char* argv[]) { - const char * inputFileName = argv[1]; - const char * inputDirName = argv[2]; + const char * inputFileName = argv[1]; + const char * inputDirName = argv[2]; itk::OStringStream msg; // Check instanciation test @@ -40,25 +39,22 @@ int otbSystemTest( int argc, char* argv[] ) delete var; var = NULL; - if ( otb::System::IsAFileName( inputFileName ) == false ) - { - itkGenericExceptionMacro( <<"System::IsAFileName() error : the filename "<<inputFileName<<" is not detected."); - } - if ( otb::System::IsADirName( inputFileName ) == true ) - { - itkGenericExceptionMacro( <<"System::IsADirName() error : the filename "<<inputFileName<<" is detected."); - } - if ( otb::System::IsAFileName( inputDirName ) == true ) - { - itkGenericExceptionMacro(<< "System::IsAFileName() error : the dirname "<<inputDirName<<" is detected!!"); - } - if ( otb::System::IsADirName( inputDirName ) == false ) - { - itkGenericExceptionMacro(<< "System::IsADirName() error : the dirname "<<inputDirName<<" is not detected!!"); - } - + if (otb::System::IsAFileName(inputFileName) == false) + { + itkGenericExceptionMacro(<< "System::IsAFileName() error : the filename " << inputFileName << " is not detected."); + } + if (otb::System::IsADirName(inputFileName) == true) + { + itkGenericExceptionMacro(<< "System::IsADirName() error : the filename " << inputFileName << " is detected."); + } + if (otb::System::IsAFileName(inputDirName) == true) + { + itkGenericExceptionMacro(<< "System::IsAFileName() error : the dirname " << inputDirName << " is detected!!"); + } + if (otb::System::IsADirName(inputDirName) == false) + { + itkGenericExceptionMacro(<< "System::IsADirName() error : the dirname " << inputDirName << " is not detected!!"); + } return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbTestCommandLineArgumentParser.cxx b/Testing/Code/Common/otbTestCommandLineArgumentParser.cxx index 94a6b2674e..b04b514c21 100644 --- a/Testing/Code/Common/otbTestCommandLineArgumentParser.cxx +++ b/Testing/Code/Common/otbTestCommandLineArgumentParser.cxx @@ -21,36 +21,32 @@ #include "itkExceptionObject.h" #include "otbCommandLineArgumentParser.h" -int otbTestCommandLineArgumentParser( int argc, char * argv[] ) +int otbTestCommandLineArgumentParser(int argc, char * argv[]) { // Parse command line parameters typedef otb::CommandLineArgumentParser ParserType; ParserType::Pointer parser = ParserType::New(); - parser->AddOption("-image","Nom d'une image","-i",1,true); - parser->AddOption("-entier","Une Valeur entiere (obligatoire)","-e"); - parser->AddOption("-deuxentiers","Deux Valeurs entieres non obligatoire","-dede",2,false); + parser->AddOption("-image", "Nom d'une image", "-i", 1, true); + parser->AddOption("-entier", "Une Valeur entiere (obligatoire)", "-e"); + parser->AddOption("-deuxentiers", "Deux Valeurs entieres non obligatoire", "-dede", 2, false); parser->AddOption("-double", "Valeur réelle double", "-d"); typedef otb::CommandLineArgumentParseResult ParserResultType; - ParserResultType::Pointer parseResult = ParserResultType::New(); + ParserResultType::Pointer parseResult = ParserResultType::New(); - parser->ParseCommandLine(argc,argv,parseResult); + parser->ParseCommandLine(argc, argv, parseResult); - - std::cout << "Image : "<<parseResult->GetParameterString("-image")<<std::endl; + std::cout << "Image : " << parseResult->GetParameterString("-image") << std::endl; unsigned int lEntier = parseResult->GetParameterUInt("-entier"); - std::cout << "Entier : "<<lEntier<<std::endl; - if ( parseResult->IsOptionPresent("-deuxentiers")) - { - std::cout << "Entier : "<<lEntier<<std::endl; - } + std::cout << "Entier : " << lEntier << std::endl; + if (parseResult->IsOptionPresent("-deuxentiers")) + { + std::cout << "Entier : " << lEntier << std::endl; + } double lDouble = parseResult->GetParameterDouble("-double"); - std::cout << "Double : "<<lDouble<<std::endl; - + std::cout << "Double : " << lDouble << std::endl; return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbTestCommandLineArgumentParserHelp.cxx b/Testing/Code/Common/otbTestCommandLineArgumentParserHelp.cxx index 9e38d4b617..3e39d5b040 100644 --- a/Testing/Code/Common/otbTestCommandLineArgumentParserHelp.cxx +++ b/Testing/Code/Common/otbTestCommandLineArgumentParserHelp.cxx @@ -22,31 +22,28 @@ #include "otbCommandLineArgumentParser.h" // Test de sortie en erreur -int otbTestCommandLineArgumentParserHelp( int argc, char * argv[] ) +int otbTestCommandLineArgumentParserHelp(int argc, char * argv[]) { try - { + { // Parse command line parameters typedef otb::CommandLineArgumentParser ParserType; ParserType::Pointer parser = ParserType::New(); - parser->AddOption("-image","Nom d'une image","-i",1,true); + parser->AddOption("-image", "Nom d'une image", "-i", 1, true); typedef otb::CommandLineArgumentParseResult ParserResultType; - ParserResultType::Pointer parseResult = ParserResultType::New(); + ParserResultType::Pointer parseResult = ParserResultType::New(); - parser->ParseCommandLine(argc,argv,parseResult); + parser->ParseCommandLine(argc, argv, parseResult); - - std::cout << "Image : "<<parseResult->GetParameterString("-image")<<std::endl; - } - catch (CommandLineArgumentParserHelpException & err) - { - std::cerr<<err; + std::cout << "Image : " << parseResult->GetParameterString("-image") << std::endl; + } + catch (CommandLineArgumentParserHelpException& err) + { + std::cerr << err; return EXIT_SUCCESS; - } + } return EXIT_FAILURE; } - - diff --git a/Testing/Code/Common/otbTestCommandLineArgumentParserList.cxx b/Testing/Code/Common/otbTestCommandLineArgumentParserList.cxx index c51ca05bbc..2b116de2b1 100644 --- a/Testing/Code/Common/otbTestCommandLineArgumentParserList.cxx +++ b/Testing/Code/Common/otbTestCommandLineArgumentParserList.cxx @@ -21,49 +21,45 @@ #include "itkExceptionObject.h" #include "otbCommandLineArgumentParser.h" -int otbTestCommandLineArgumentParserList( int argc, char * argv[] ) +int otbTestCommandLineArgumentParserList(int argc, char * argv[]) { // Parse command line parameters typedef otb::CommandLineArgumentParser ParserType; ParserType::Pointer parser = ParserType::New(); - parser->AddOption("-image","Nom d'une image","-i",1,true); - parser->AddOption("-entier","Une Valeur entiere (obligatoire)","-e"); - parser->AddOption("-deuxentiers","Deux Valeurs entieres non obligatoire","-dede",2,false); + parser->AddOption("-image", "Nom d'une image", "-i", 1, true); + parser->AddOption("-entier", "Une Valeur entiere (obligatoire)", "-e"); + parser->AddOption("-deuxentiers", "Deux Valeurs entieres non obligatoire", "-dede", 2, false); parser->AddOption("-double", "Valeur réelle double", "-d"); - parser->AddOptionNParams("-doubles", "Liste de Valeurs réelles","-ld",false); + parser->AddOptionNParams("-doubles", "Liste de Valeurs réelles", "-ld", false); typedef otb::CommandLineArgumentParseResult ParserResultType; - ParserResultType::Pointer parseResult = ParserResultType::New(); + ParserResultType::Pointer parseResult = ParserResultType::New(); - parser->ParseCommandLine(argc,argv,parseResult); + parser->ParseCommandLine(argc, argv, parseResult); - - std::cout << "Image : "<<parseResult->GetParameterString("-image")<<std::endl; + std::cout << "Image : " << parseResult->GetParameterString("-image") << std::endl; //unsigned int lEntier = otb::GetParameter<unsigned int>(parseResult,"-entier"); unsigned int lEntier = parseResult->GetParameterUInt("-entier"); - std::cout << "Entier : "<<lEntier<<std::endl; - if ( parseResult->IsOptionPresent("-deuxentiers")) - { + std::cout << "Entier : " << lEntier << std::endl; + if (parseResult->IsOptionPresent("-deuxentiers")) + { //unsigned int lEntierDeux = otb::GetParameter<unsigned int>(parseResult,"-deuxentiers",1); - unsigned int lEntierDeux = parseResult->GetParameterUInt("-deuxentiers",1); - std::cout << "Entier : "<<lEntierDeux<<std::endl; - } + unsigned int lEntierDeux = parseResult->GetParameterUInt("-deuxentiers", 1); + std::cout << "Entier : " << lEntierDeux << std::endl; + } //double lDouble = otb::GetParameter<double>(parseResult,"-double"); double lDouble = parseResult->GetParameterDouble("-double"); - std::cout << "Double : "<<lDouble<<std::endl; + std::cout << "Double : " << lDouble << std::endl; - std::cout << "List de Double : "<<parseResult->GetNumberOfParameters("-doubles")<<std::endl; - for (int i =0; i<parseResult->GetNumberOfParameters("-doubles"); i++) - { + std::cout << "List de Double : " << parseResult->GetNumberOfParameters("-doubles") << std::endl; + for (int i = 0; i < parseResult->GetNumberOfParameters("-doubles"); i++) + { //double value = otb::GetParameter<double>(parseResult,"-doubles",i); - double value = parseResult->GetParameterDouble("-doubles",i); - std::cout << " "<<value; - } + double value = parseResult->GetParameterDouble("-doubles", i); + std::cout << " " << value; + } std::cout << std::endl; - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbTestCommandLineArgumentParserWithError.cxx b/Testing/Code/Common/otbTestCommandLineArgumentParserWithError.cxx index d840ac51d5..a78ffc3d9d 100644 --- a/Testing/Code/Common/otbTestCommandLineArgumentParserWithError.cxx +++ b/Testing/Code/Common/otbTestCommandLineArgumentParserWithError.cxx @@ -21,46 +21,43 @@ #include "itkExceptionObject.h" #include "otbCommandLineArgumentParser.h" -int otbTestCommandLineArgumentParserWithError( int argc, char * argv[] ) +int otbTestCommandLineArgumentParserWithError(int argc, char * argv[]) { // Parse command line parameters typedef otb::CommandLineArgumentParser ParserType; ParserType::Pointer parser = ParserType::New(); - parser->AddOption("-image","Nom d'une image","-i",1,true); - parser->AddOption("-entier","Une Valeur entiere (obligatoire)","-e"); - parser->AddOption("-deuxentiers","Deux Valeurs entieres non obligatoire","-dede",2,false); + parser->AddOption("-image", "Nom d'une image", "-i", 1, true); + parser->AddOption("-entier", "Une Valeur entiere (obligatoire)", "-e"); + parser->AddOption("-deuxentiers", "Deux Valeurs entieres non obligatoire", "-dede", 2, false); parser->AddOption("-double", "Valeur réelle double", "-d"); typedef otb::CommandLineArgumentParseResult ParserResultType; - ParserResultType::Pointer parseResult = ParserResultType::New(); + ParserResultType::Pointer parseResult = ParserResultType::New(); try - { - - parser->ParseCommandLine(argc,argv,parseResult); + { + parser->ParseCommandLine(argc, argv, parseResult); - std::cout << "Image : "<<parseResult->GetParameterString("-image")<<std::endl; + std::cout << "Image : " << parseResult->GetParameterString("-image") << std::endl; //unsigned int lEntier = otb::GetParameter<unsigned int>(parseResult,"-entier"); unsigned int lEntier = parseResult->GetParameterUInt("-entier"); - std::cout << "Entier : "<<lEntier<<std::endl; - if ( parseResult->IsOptionPresent("-deuxentiers")) - { + std::cout << "Entier : " << lEntier << std::endl; + if (parseResult->IsOptionPresent("-deuxentiers")) + { //unsigned int lEntierDeux = otb::GetParameter<unsigned int>(parseResult,"-deuxentiers",1); - unsigned int lEntierDeux = parseResult->GetParameterUInt("-deuxentiers",1); - std::cout << "Entier : "<<lEntierDeux<<std::endl; - } + unsigned int lEntierDeux = parseResult->GetParameterUInt("-deuxentiers", 1); + std::cout << "Entier : " << lEntierDeux << std::endl; + } //double lDouble = otb::GetParameter<double>(parseResult,"-double"); double lDouble = parseResult->GetParameterDouble("-double"); - std::cout << "Double : "<<lDouble<<std::endl; - } - catch (CommandLineArgumentParserArgumentErrorException & err) - { - std::cerr<<err; + std::cout << "Double : " << lDouble << std::endl; + } + catch (CommandLineArgumentParserArgumentErrorException& err) + { + std::cerr << err; return EXIT_SUCCESS; - } + } return EXIT_FAILURE; } - - diff --git a/Testing/Code/Common/otbTestMultiExtractMultiUpdate.cxx b/Testing/Code/Common/otbTestMultiExtractMultiUpdate.cxx index f4bc82a146..f102005f5f 100644 --- a/Testing/Code/Common/otbTestMultiExtractMultiUpdate.cxx +++ b/Testing/Code/Common/otbTestMultiExtractMultiUpdate.cxx @@ -24,7 +24,6 @@ #include "otbSystem.h" - int otbTestMultiExtractMultiUpdate(int argc, char * argv[]) { const unsigned int Dimension = 2; @@ -39,24 +38,23 @@ int otbTestMultiExtractMultiUpdate(int argc, char * argv[]) reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); - ExtractInternVectorType::Pointer extractInternVector = ExtractInternVectorType::New(); //readerMS->UpdateOutputInformation(); - extractInternVector->SetInput( reader->GetOutput() ); - extractInternVector->SetStartX( atoi(argv[3]) ); - extractInternVector->SetStartY( atoi(argv[4]) ); - extractInternVector->SetSizeX( atoi(argv[5]) ); - extractInternVector->SetSizeY( atoi(argv[6]) ); + extractInternVector->SetInput(reader->GetOutput()); + extractInternVector->SetStartX(atoi(argv[3])); + extractInternVector->SetStartY(atoi(argv[4])); + extractInternVector->SetSizeX(atoi(argv[5])); + extractInternVector->SetSizeY(atoi(argv[6])); - extractInternVector->SetFirstChannel( atoi(argv[7] )); - extractInternVector->SetLastChannel( atoi(argv[8]) ); + extractInternVector->SetFirstChannel(atoi(argv[7])); + extractInternVector->SetLastChannel(atoi(argv[8])); extractInternVector->Update(); extractInternVector->Update(); extractInternVector->Update(); - writer->SetInput( extractInternVector->GetOutput() ); + writer->SetInput(extractInternVector->GetOutput()); writer->Update(); diff --git a/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilter.cxx b/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilter.cxx index e00b8fb3b9..316fd89a20 100644 --- a/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilter.cxx +++ b/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilter.cxx @@ -29,18 +29,17 @@ template <class TIter, class TOutput> class UnaryFunctorNeighborhoodImageFilterTest { public: - UnaryFunctorNeighborhoodImageFilterTest() {}; - ~UnaryFunctorNeighborhoodImageFilterTest() {}; + UnaryFunctorNeighborhoodImageFilterTest() {} + ~UnaryFunctorNeighborhoodImageFilterTest() {} - inline TOutput operator() (const TIter & it) + inline TOutput operator ()(const TIter& it) { - return(static_cast<TOutput>(it.GetCenterPixel())); + return (static_cast<TOutput>(it.GetCenterPixel())); } }; } - int otbUnaryFunctorNeighborhoodImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; @@ -48,19 +47,20 @@ int otbUnaryFunctorNeighborhoodImageFilter(int argc, char * argv[]) typedef unsigned char InputPixelType; const int Dimension = 2; - typedef otb::Image<InputPixelType,Dimension> ImageType; - typedef ImageType::PixelType PixelType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::Image<InputPixelType, Dimension> ImageType; + typedef ImageType::PixelType PixelType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::ConstNeighborhoodIterator<ImageType> IterType;; - typedef Functor::UnaryFunctorNeighborhoodImageFilterTest<IterType, PixelType> FunctorType; - typedef otb::UnaryFunctorNeighborhoodImageFilter<ImageType, ImageType, FunctorType> UnaryFunctorNeighborhoodImageFilterType; + typedef itk::ConstNeighborhoodIterator<ImageType> IterType; + typedef Functor::UnaryFunctorNeighborhoodImageFilterTest<IterType, PixelType> FunctorType; + typedef otb::UnaryFunctorNeighborhoodImageFilter<ImageType, ImageType, + FunctorType> UnaryFunctorNeighborhoodImageFilterType; // Instantiating object UnaryFunctorNeighborhoodImageFilterType::Pointer object = UnaryFunctorNeighborhoodImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -70,6 +70,5 @@ int otbUnaryFunctorNeighborhoodImageFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilterNew.cxx b/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilterNew.cxx index 4d0a3409b9..62237fb9ec 100644 --- a/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilterNew.cxx +++ b/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilterNew.cxx @@ -20,34 +20,33 @@ #include "otbUnaryFunctorNeighborhoodImageFilter.h" #include "otbImage.h" - namespace Functor { template <class TIter, class TOutput> class UnaryFunctorNeighborhoodImageFilterFunctorNewTest { public: - UnaryFunctorNeighborhoodImageFilterFunctorNewTest() {}; - ~UnaryFunctorNeighborhoodImageFilterFunctorNewTest() {}; + UnaryFunctorNeighborhoodImageFilterFunctorNewTest() {} + ~UnaryFunctorNeighborhoodImageFilterFunctorNewTest() {} - inline TOutput operator() (const TIter & it) + inline TOutput operator ()(const TIter& it) { - return(static_cast<TOutput>(it.GetCenterPixel())); + return (static_cast<TOutput>(it.GetCenterPixel())); } }; } - int otbUnaryFunctorNeighborhoodImageFilterNew(int argc, char * argv[]) { typedef double InputPixelType; const int Dimension = 2; - typedef otb::Image<InputPixelType,Dimension> ImageType; - typedef ImageType::PixelType PixelType; - typedef itk::ConstNeighborhoodIterator<ImageType> IterType;; - typedef Functor::UnaryFunctorNeighborhoodImageFilterFunctorNewTest<IterType, PixelType> FunctorType; - typedef otb::UnaryFunctorNeighborhoodImageFilter<ImageType, ImageType, FunctorType> UnaryFunctorNeighborhoodImageFilterType; + typedef otb::Image<InputPixelType, Dimension> ImageType; + typedef ImageType::PixelType PixelType; + typedef itk::ConstNeighborhoodIterator<ImageType> IterType; + typedef Functor::UnaryFunctorNeighborhoodImageFilterFunctorNewTest<IterType, PixelType> FunctorType; + typedef otb::UnaryFunctorNeighborhoodImageFilter<ImageType, ImageType, + FunctorType> UnaryFunctorNeighborhoodImageFilterType; // Instantiating object UnaryFunctorNeighborhoodImageFilterType::Pointer object = UnaryFunctorNeighborhoodImageFilterType::New(); diff --git a/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.cxx b/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.cxx index 2f811e0cba..541c980baa 100644 --- a/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.cxx +++ b/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.cxx @@ -29,8 +29,8 @@ template <class TInput, class TOutput> class UnaryFunctorNeighborhoodWithOffseImageFilterTest { public: - UnaryFunctorNeighborhoodWithOffseImageFilterTest() {}; - ~UnaryFunctorNeighborhoodWithOffseImageFilterTest() {}; + UnaryFunctorNeighborhoodWithOffseImageFilterTest() {} + ~UnaryFunctorNeighborhoodWithOffseImageFilterTest() {} typedef TInput InputScalarType; typedef TOutput OutputScalarType; @@ -42,20 +42,20 @@ public: void SetOffset(OffsetType off) { - m_Offset=off; - }; + m_Offset = off; + } OffsetType GetOffset() { return m_Offset; - }; + } - inline OutputScalarType operator() (const NeighborhoodType & neigh) + inline OutputScalarType operator ()(const NeighborhoodType& neigh) { - return(static_cast<OutputScalarType>(neigh.GetCenterValue())); + return (static_cast<OutputScalarType>(neigh.GetCenterValue())); } - inline OutputVectorType operator() (const NeighborhoodVectorType & neigh) + inline OutputVectorType operator ()(const NeighborhoodVectorType& neigh) { - return(static_cast<OutputVectorType>(neigh.GetCenterValue())); + return (static_cast<OutputVectorType>(neigh.GetCenterValue())); } private: @@ -63,27 +63,27 @@ private: }; } - int otbUnaryFunctorNeighborhoodWithOffsetImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; - typedef double InputPixelType; - const int Dimension = 2; - typedef otb::VectorImage<InputPixelType,Dimension> ImageType; - typedef ImageType::OffsetType OffsetType; - typedef ImageType::PixelType PixelType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::ConstNeighborhoodIterator<ImageType> IterType;; - typedef Functor::UnaryFunctorNeighborhoodWithOffseImageFilterTest<InputPixelType, InputPixelType> FunctorType; - typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter<ImageType, ImageType, FunctorType> UnaryFunctorNeighborhoodImageFilterType; + typedef double InputPixelType; + const int Dimension = 2; + typedef otb::VectorImage<InputPixelType, Dimension> ImageType; + typedef ImageType::OffsetType OffsetType; + typedef ImageType::PixelType PixelType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::ConstNeighborhoodIterator<ImageType> IterType; + typedef Functor::UnaryFunctorNeighborhoodWithOffseImageFilterTest<InputPixelType, InputPixelType> FunctorType; + typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter<ImageType, ImageType, + FunctorType> UnaryFunctorNeighborhoodImageFilterType; // Instantiating object UnaryFunctorNeighborhoodImageFilterType::Pointer object = UnaryFunctorNeighborhoodImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -98,6 +98,5 @@ int otbUnaryFunctorNeighborhoodWithOffsetImageFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew.cxx b/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew.cxx index 52e3a337dc..43e229e51d 100644 --- a/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew.cxx +++ b/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew.cxx @@ -28,8 +28,8 @@ template <class TInput, class TOutput> class UnaryFunctorNeighborhoodWithOffsetImageFilterFunctorNewTest { public: - UnaryFunctorNeighborhoodWithOffsetImageFilterFunctorNewTest() {}; - ~UnaryFunctorNeighborhoodWithOffsetImageFilterFunctorNewTest() {}; + UnaryFunctorNeighborhoodWithOffsetImageFilterFunctorNewTest() {} + ~UnaryFunctorNeighborhoodWithOffsetImageFilterFunctorNewTest() {} typedef TInput InputScalarType; typedef TOutput OutputScalarType; @@ -41,20 +41,20 @@ public: void SetOffset(OffsetType off) { - m_Offset=off; - }; + m_Offset = off; + } OffsetType GetOffset() { return m_Offset; - }; + } - inline OutputScalarType operator() (const NeighborhoodType & neigh) + inline OutputScalarType operator ()(const NeighborhoodType& neigh) { - return(static_cast<OutputScalarType>(neigh.GetCenterValue())); + return (static_cast<OutputScalarType>(neigh.GetCenterValue())); } - inline OutputVectorType operator() (const NeighborhoodVectorType & neigh) + inline OutputVectorType operator ()(const NeighborhoodVectorType& neigh) { - return(static_cast<OutputVectorType>(neigh.GetCenterValue())); + return (static_cast<OutputVectorType>(neigh.GetCenterValue())); } @@ -63,20 +63,24 @@ private: }; } - int otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew(int argc, char * argv[]) { typedef double InputPixelType; const int Dimension = 2; - typedef otb::VectorImage<InputPixelType,Dimension> ImageType; - typedef ImageType::PixelType PixelType; - typedef itk::ConstNeighborhoodIterator<ImageType> IterType;; - typedef Functor::UnaryFunctorNeighborhoodWithOffsetImageFilterFunctorNewTest<InputPixelType, InputPixelType> FunctorType; - typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter<ImageType, ImageType, FunctorType> UnaryFunctorNeighborhoodWithOffsetImageFilterType; + typedef otb::VectorImage<InputPixelType, + Dimension> ImageType; + typedef ImageType::PixelType + PixelType; + typedef itk::ConstNeighborhoodIterator<ImageType> IterType; + typedef Functor::UnaryFunctorNeighborhoodWithOffsetImageFilterFunctorNewTest<InputPixelType, + InputPixelType> FunctorType; + typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter<ImageType, ImageType, + FunctorType> + UnaryFunctorNeighborhoodWithOffsetImageFilterType; // Instantiating object - UnaryFunctorNeighborhoodWithOffsetImageFilterType::Pointer object = UnaryFunctorNeighborhoodWithOffsetImageFilterType::New(); + UnaryFunctorNeighborhoodWithOffsetImageFilterType::Pointer object = + UnaryFunctorNeighborhoodWithOffsetImageFilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilter.cxx b/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilter.cxx index 343f80644d..0d643c37e5 100644 --- a/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilter.cxx +++ b/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilter.cxx @@ -28,37 +28,37 @@ template <class TInput, class TOutput> class UnaryFunctorWithIndexImageFilterFunctorTest { public: - UnaryFunctorWithIndexImageFilterFunctorTest() {}; - ~UnaryFunctorWithIndexImageFilterFunctorTest() {}; + UnaryFunctorWithIndexImageFilterFunctorTest() {} + ~UnaryFunctorWithIndexImageFilterFunctorTest() {} typedef itk::Index<2> IndexType; - inline TOutput operator() (const TInput & inPix, IndexType index) + inline TOutput operator ()(const TInput& inPix, IndexType index) { - return(static_cast<TOutput>(inPix)); + return (static_cast<TOutput>(inPix)); } }; } - int otbUnaryFunctorWithIndexImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; - typedef double InputPixelType; - typedef otb::VectorImage<InputPixelType,2> ImageType; - typedef ImageType::PixelType PixelType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef double InputPixelType; + typedef otb::VectorImage<InputPixelType, 2> ImageType; + typedef ImageType::PixelType PixelType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; - typedef Functor::UnaryFunctorWithIndexImageFilterFunctorTest<PixelType, PixelType> FunctorType; - typedef otb::UnaryFunctorWithIndexImageFilter<ImageType, ImageType, FunctorType> UnaryFunctorWithIndexImageFilterType; + typedef Functor::UnaryFunctorWithIndexImageFilterFunctorTest<PixelType, PixelType> FunctorType; + typedef otb::UnaryFunctorWithIndexImageFilter<ImageType, ImageType, + FunctorType> UnaryFunctorWithIndexImageFilterType; // Instantiating object UnaryFunctorWithIndexImageFilterType::Pointer object = UnaryFunctorWithIndexImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -67,6 +67,5 @@ int otbUnaryFunctorWithIndexImageFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilterNew.cxx b/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilterNew.cxx index 1d1d70e1aa..266d7f1901 100644 --- a/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilterNew.cxx +++ b/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilterNew.cxx @@ -20,33 +20,32 @@ #include "otbUnaryFunctorWithIndexImageFilter.h" #include "otbImage.h" - namespace Functor { template <class TInput, class TOutput> class UnaryFunctorWithIndexImageFilterFunctorNewTest { public: - UnaryFunctorWithIndexImageFilterFunctorNewTest() {}; - ~UnaryFunctorWithIndexImageFilterFunctorNewTest() {}; + UnaryFunctorWithIndexImageFilterFunctorNewTest() {} + ~UnaryFunctorWithIndexImageFilterFunctorNewTest() {} typedef itk::Index<2> IndexType; - inline TOutput operator() (const TInput & inPix, IndexType index) + inline TOutput operator ()(const TInput& inPix, IndexType index) { - return(static_cast<TOutput>(inPix)); + return (static_cast<TOutput>(inPix)); } }; } - int otbUnaryFunctorWithIndexImageFilterNew(int argc, char * argv[]) { - typedef double InputPixelType; - typedef otb::Image<InputPixelType, 2> ImageType; - typedef ImageType::PixelType PixelType; - typedef Functor::UnaryFunctorWithIndexImageFilterFunctorNewTest<PixelType, PixelType> FunctorType; - typedef otb::UnaryFunctorWithIndexImageFilter<ImageType, ImageType, FunctorType> UnaryFunctorWithIndexImageFilterType; + typedef double InputPixelType; + typedef otb::Image<InputPixelType, 2> ImageType; + typedef ImageType::PixelType PixelType; + typedef Functor::UnaryFunctorWithIndexImageFilterFunctorNewTest<PixelType, PixelType> FunctorType; + typedef otb::UnaryFunctorWithIndexImageFilter<ImageType, ImageType, + FunctorType> UnaryFunctorWithIndexImageFilterType; // Instantiating object UnaryFunctorWithIndexImageFilterType::Pointer object = UnaryFunctorWithIndexImageFilterType::New(); diff --git a/Testing/Code/Common/otbVectorData.cxx b/Testing/Code/Common/otbVectorData.cxx index a2e5a794e4..7d76c92631 100644 --- a/Testing/Code/Common/otbVectorData.cxx +++ b/Testing/Code/Common/otbVectorData.cxx @@ -23,11 +23,11 @@ int otbVectorData(int argc, char * argv[]) { - typedef otb::VectorData<double,2> VectorDataType; + typedef otb::VectorData<double, 2> VectorDataType; typedef VectorDataType::DataNodeType DataNodeType; - typedef DataNodeType::PointType PointType; - typedef DataNodeType::LineType LineType; - typedef DataNodeType::PolygonType PolygonType; + typedef DataNodeType::PointType PointType; + typedef DataNodeType::LineType LineType; + typedef DataNodeType::PolygonType PolygonType; //Instantiation VectorDataType::Pointer data = VectorDataType::New(); @@ -38,7 +38,6 @@ int otbVectorData(int argc, char * argv[]) DataNodeType::Pointer line = DataNodeType::New(); DataNodeType::Pointer polygon = DataNodeType::New(); - document->SetNodeType(otb::DOCUMENT); folder->SetNodeType(otb::FOLDER); point->SetNodeType(otb::FEATURE_POINT); @@ -54,7 +53,7 @@ int otbVectorData(int argc, char * argv[]) PointType p; p.Fill(5); - point->SetPoint(p);; + point->SetPoint(p); LineType::Pointer l = LineType::New(); line->SetLine(l); @@ -64,26 +63,26 @@ int otbVectorData(int argc, char * argv[]) DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get(); - data->GetDataTree()->Add(document,root); - data->GetDataTree()->Add(folder,document); - data->GetDataTree()->Add(point,folder); - data->GetDataTree()->Add(line,folder); - data->GetDataTree()->Add(polygon,folder); + data->GetDataTree()->Add(document, root); + data->GetDataTree()->Add(folder, document); + data->GetDataTree()->Add(point, folder); + data->GetDataTree()->Add(line, folder); + data->GetDataTree()->Add(polygon, folder); if (argc < 2) - { + { std::cout << data << std::endl; - } + } else - { - const char * outfile = argv[1]; + { + const char * outfile = argv[1]; std::ofstream file; file.open(outfile); file << data << std::endl; file.close(); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbVectorDataExtractROI.cxx b/Testing/Code/Common/otbVectorDataExtractROI.cxx index 2ddb820814..b54dda0dc6 100644 --- a/Testing/Code/Common/otbVectorDataExtractROI.cxx +++ b/Testing/Code/Common/otbVectorDataExtractROI.cxx @@ -22,24 +22,24 @@ #include "otbVectorDataFileReader.h" #include "otbVectorDataFileWriter.h" -int otbVectorDataExtractROI( int argc, char * argv[] ) +int otbVectorDataExtractROI(int argc, char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; - const long int startX = atoi(argv[3]); - const long int startY = atoi(argv[4]); - const long int sizeX = atoi(argv[5]); - const long int sizeY = atoi(argv[6]); + const long int startX = atoi(argv[3]); + const long int startY = atoi(argv[4]); + const long int sizeX = atoi(argv[5]); + const long int sizeY = atoi(argv[6]); - typedef double Type; + typedef double Type; - typedef otb::VectorData<> VectorDataType; - typedef otb::VectorDataExtractROI< VectorDataType > FilterType; - typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; - typedef otb::VectorDataFileWriter<VectorDataType> VectorDataWriterType; + typedef otb::VectorData<> VectorDataType; + typedef otb::VectorDataExtractROI<VectorDataType> FilterType; + typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; + typedef otb::VectorDataFileWriter<VectorDataType> VectorDataWriterType; - typedef otb::RemoteSensingRegion<Type> TypedRegion; + typedef otb::RemoteSensingRegion<Type> TypedRegion; /** Instantiation of pointer objects*/ FilterType::Pointer filter = FilterType::New(); @@ -47,9 +47,9 @@ int otbVectorDataExtractROI( int argc, char * argv[] ) VectorDataWriterType::Pointer writer = VectorDataWriterType::New(); /** Edit The cartoRegion*/ - TypedRegion region; - TypedRegion::SizeType size; - TypedRegion::IndexType index; + TypedRegion region; + TypedRegion::SizeType size; + TypedRegion::IndexType index; size[0] = sizeX; size[1] = sizeY; @@ -57,7 +57,8 @@ int otbVectorDataExtractROI( int argc, char * argv[] ) index[1] = startY; /*Set the projection */ - std::string projectionRefWkt ="PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; + std::string projectionRefWkt = + "PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; region.SetSize(size); region.SetOrigin(index); @@ -74,8 +75,5 @@ int otbVectorDataExtractROI( int argc, char * argv[] ) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbVectorDataExtractROINew.cxx b/Testing/Code/Common/otbVectorDataExtractROINew.cxx index ee2f998747..1d482166cd 100644 --- a/Testing/Code/Common/otbVectorDataExtractROINew.cxx +++ b/Testing/Code/Common/otbVectorDataExtractROINew.cxx @@ -18,16 +18,12 @@ #include "otbVectorData.h" #include "otbVectorDataExtractROI.h" -int otbVectorDataExtractROINew( int argc, char * argv[] ) +int otbVectorDataExtractROINew(int argc, char * argv[]) { - typedef otb::VectorData<> VectorDataType; - typedef otb::VectorDataExtractROI< VectorDataType > FilterType; - + typedef otb::VectorData<> VectorDataType; + typedef otb::VectorDataExtractROI<VectorDataType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbVectorDataNew.cxx b/Testing/Code/Common/otbVectorDataNew.cxx index e330b5e5bc..421092c2a0 100644 --- a/Testing/Code/Common/otbVectorDataNew.cxx +++ b/Testing/Code/Common/otbVectorDataNew.cxx @@ -23,7 +23,7 @@ int otbVectorDataNew(int argc, char * argv[]) { - typedef otb::VectorData<double,2> VectorDataType; + typedef otb::VectorData<double, 2> VectorDataType; //Instantiation VectorDataType::Pointer data = VectorDataType::New(); diff --git a/Testing/Code/Common/otbVectorDataSourceNew.cxx b/Testing/Code/Common/otbVectorDataSourceNew.cxx index 19245f7923..ec3aec3c8c 100644 --- a/Testing/Code/Common/otbVectorDataSourceNew.cxx +++ b/Testing/Code/Common/otbVectorDataSourceNew.cxx @@ -20,17 +20,15 @@ #include "otbVectorDataSource.h" #include "otbVectorData.h" - int otbVectorDataSourceNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef otb::VectorData<InputPixelType,Dimension> InputVectorDataType; + typedef double InputPixelType; + typedef otb::VectorData<InputPixelType, Dimension> InputVectorDataType; typedef otb::VectorDataSource<InputVectorDataType> VectorDataSourceType; // Instantiating VectorDataSource object VectorDataSourceType::Pointer VectorData = VectorDataSourceType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbVectorDataToGISTableFilter.cxx b/Testing/Code/Common/otbVectorDataToGISTableFilter.cxx index c794899675..f5dc310030 100644 --- a/Testing/Code/Common/otbVectorDataToGISTableFilter.cxx +++ b/Testing/Code/Common/otbVectorDataToGISTableFilter.cxx @@ -33,37 +33,36 @@ int otbVectorDataToGISTableFilter(int argc, char * argv[]) { - if ( argc != 5 ) - { + if (argc != 5) + { std::cerr << "Usage: " << argv[0]; std::cerr << " inputFile(shp) dbName userName userPassword" << std::endl; return EXIT_FAILURE; - } - + } + const unsigned int dim = 2; typedef unsigned char PType; //typedef otb::VectorData<> VectorDataType; - - typedef otb::PostGISConnectionImplementation BdConnection; + + typedef otb::PostGISConnectionImplementation BdConnection; typedef otb::PostGISConnectionImplementation::Pointer BdConnectionPointer; - + BdConnectionPointer myConnection = BdConnection::New(); - - + //myConnection->PostGISConnectionImplementation(); //const std::string hostName = argv[1]; const std::string dbName = argv[2]; const std::string userName = argv[3]; const std::string userPassword = argv[4]; - - myConnection->SetHost( "localhost" ); - myConnection->SetDBName( dbName ); - myConnection->SetUser( userName ); - myConnection->SetPassword( userPassword ); - + + myConnection->SetHost("localhost"); + myConnection->SetDBName(dbName); + myConnection->SetUser(userName); + myConnection->SetPassword(userPassword); + //myConnection->ConnectToDB(); - + typedef otb::PostGISTable<BdConnection, double, 2> PostGISTableType; //Instantiation @@ -73,26 +72,26 @@ int otbVectorDataToGISTableFilter(int argc, char * argv[]) //data->SetTableName(myTableName); //std::cout << "YES" << std::endl; //input : the vectordata - + typedef unsigned short int PixelType; // Software Guide : BeginLatex - // +// // We define the types for the vector data structure and the // corresponding file reader. - // +// // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef otb::VectorData<PixelType,dim> VectorDataType; + typedef otb::VectorData<PixelType, dim> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex - // +// // We can now instantiate the reader and read the data. - // +// // Software Guide : EndLatex // Software Guide : BeginCodeSnippet @@ -100,17 +99,16 @@ int otbVectorDataToGISTableFilter(int argc, char * argv[]) VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); reader->SetFileName(argv[1]); reader->Update(); - // std::cout << "YES" << std::endl; + // std::cout << "YES" << std::endl; typedef otb::VectorDataToGISTableFilter<VectorDataType, PostGISTableType> VectorDataToGISTableFilterType; VectorDataToGISTableFilterType::Pointer myFilter = VectorDataToGISTableFilterType::New(); myFilter->SetInput(reader->GetOutput()); //std::cout << "after set input filter" << std::endl; - + myFilter->SetInputGISConnection(myConnection); myFilter->SetDropExistingGISTable (true); //myFilter->SetGISTableName ("test_filter"); myFilter->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbVectorDataToGISTableFilterNew.cxx b/Testing/Code/Common/otbVectorDataToGISTableFilterNew.cxx index 1671a0b32c..63c3463146 100644 --- a/Testing/Code/Common/otbVectorDataToGISTableFilterNew.cxx +++ b/Testing/Code/Common/otbVectorDataToGISTableFilterNew.cxx @@ -25,20 +25,15 @@ int otbVectorDataToGISTableFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; - - typedef otb::VectorData<PixelType > VectorDataType; - - - typedef otb::PostGISConnectionImplementation BdConnection; + + typedef otb::VectorData<PixelType> VectorDataType; + + typedef otb::PostGISConnectionImplementation BdConnection; typedef otb::GISTable<BdConnection, PixelType, Dimension> GISTableType; - - + typedef otb::VectorDataToGISTableFilter<VectorDataType, GISTableType> VectorDataToGISTableFilterType; VectorDataToGISTableFilterType::Pointer vectorData = VectorDataToGISTableFilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbVectorDataToImageFilter.cxx b/Testing/Code/Common/otbVectorDataToImageFilter.cxx index 948eacf0b0..c0d72377b4 100644 --- a/Testing/Code/Common/otbVectorDataToImageFilter.cxx +++ b/Testing/Code/Common/otbVectorDataToImageFilter.cxx @@ -31,15 +31,15 @@ int otbVectorDataToImageFilter(int argc, char * argv[]) { - if (argc < 3 ) - { - std::cout << argv[0] <<" <input vector filename> <input image filename>" << std::endl; + if (argc < 3) + { + std::cout << argv[0] << " <input vector filename> <input image filename>" << std::endl; return EXIT_FAILURE; - } + } //Read the vector data - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); @@ -50,32 +50,32 @@ int otbVectorDataToImageFilter(int argc, char * argv[]) ProjectionFilterType::Pointer projection = ProjectionFilterType::New(); projection->SetInput(reader->GetOutput()); - std::string projectionRefWkt ="PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; + std::string projectionRefWkt = + "PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; projection->SetOutputProjectionRef(projectionRefWkt); - //Convert the vector data into an image - typedef itk::RGBAPixel< unsigned char > PixelType; - typedef otb::Image<PixelType,2> ImageType; + typedef itk::RGBAPixel<unsigned char> PixelType; + typedef otb::Image<PixelType, 2> ImageType; ImageType::SizeType size; size[0] = 500; size[1] = 500; ImageType::PointType origin; - origin[0] = 374149.980555821;//UL easting - origin[1] = 4829183.99443839;//UL northing + origin[0] = 374149.980555821; //UL easting + origin[1] = 4829183.99443839; //UL northing ImageType::SpacingType spacing; spacing[0] = 0.6; spacing[1] = -0.6; typedef otb::RemoteSensingRegion<double> RegionType; - RegionType region; + RegionType region; RegionType::SizeType sizeInUnit; - sizeInUnit[0] = size[0]*spacing[0]; - sizeInUnit[1] = size[1]*spacing[1]; + sizeInUnit[0] = size[0] * spacing[0]; + sizeInUnit[1] = size[1] * spacing[1]; region.SetSize(sizeInUnit); region.SetOrigin(origin); region.SetRegionProjection(projectionRefWkt); diff --git a/Testing/Code/Common/otbVectorDataToImageFilterNew.cxx b/Testing/Code/Common/otbVectorDataToImageFilterNew.cxx index 0e83599ab4..14eae25dbe 100644 --- a/Testing/Code/Common/otbVectorDataToImageFilterNew.cxx +++ b/Testing/Code/Common/otbVectorDataToImageFilterNew.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkRGBAPixel.h" #include "otbImage.h" #include "otbVectorData.h" @@ -25,9 +24,9 @@ int otbVectorDataToImageFilterNew(int argc, char * argv[]) { - typedef otb::VectorData<> VectorDataType; - typedef itk::RGBAPixel< unsigned char > PixelType; - typedef otb::Image<PixelType,2> ImageType; + typedef otb::VectorData<> VectorDataType; + typedef itk::RGBAPixel<unsigned char> PixelType; + typedef otb::Image<PixelType, 2> ImageType; typedef otb::VectorDataToImageFilter<VectorDataType, ImageType> VectorDataToImageFilterType; VectorDataToImageFilterType::Pointer vectorDataRendering = VectorDataToImageFilterType::New(); diff --git a/Testing/Code/Common/otbVectorDataToImageFilterSensorModel.cxx b/Testing/Code/Common/otbVectorDataToImageFilterSensorModel.cxx index 53a7c0c220..1d0cda321c 100644 --- a/Testing/Code/Common/otbVectorDataToImageFilterSensorModel.cxx +++ b/Testing/Code/Common/otbVectorDataToImageFilterSensorModel.cxx @@ -32,28 +32,27 @@ int otbVectorDataToImageFilterSensorModel(int argc, char * argv[]) { - if (argc < 4 ) - { - std::cout << argv[0] <<" <input vector filename> <input image filename>" - << " <output vector filename> " << std::endl; + if (argc < 4) + { + std::cout << argv[0] << " <input vector filename> <input image filename>" + << " <output vector filename> " << std::endl; return EXIT_FAILURE; - } + } //Read the vector data - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); reader->SetFileName(argv[1]); //Read the image (only for the information) - typedef otb::Image<unsigned short int, 2> SensorImageType; + typedef otb::Image<unsigned short int, 2> SensorImageType; typedef otb::ImageFileReader<SensorImageType> ImageReaderType; ImageReaderType::Pointer imageReader = ImageReaderType::New(); imageReader->SetFileName(argv[2]); imageReader->UpdateOutputInformation(); - //Reproject the vector data in the proper projection typedef otb::VectorDataProjectionFilter<VectorDataType, VectorDataType> ProjectionFilterType; ProjectionFilterType::Pointer projection = ProjectionFilterType::New(); @@ -63,10 +62,9 @@ int otbVectorDataToImageFilterSensorModel(int argc, char * argv[]) projection->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); projection->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); - //Convert the vector data into an image - typedef itk::RGBAPixel< unsigned char > PixelType; - typedef otb::Image<PixelType,2> ImageType; + typedef itk::RGBAPixel<unsigned char> PixelType; + typedef otb::Image<PixelType, 2> ImageType; ImageType::SizeType size; size[0] = 500; @@ -81,12 +79,12 @@ int otbVectorDataToImageFilterSensorModel(int argc, char * argv[]) ImageType::SpacingType spacing; // spacing[0] = imageReader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/static_cast<double>(size[0]); // spacing[1] = imageReader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/static_cast<double>(size[1]); - spacing[0] = 500/static_cast<double>(size[0]); - spacing[1] = 500/static_cast<double>(size[1]); + spacing[0] = 500 / static_cast<double>(size[0]); + spacing[1] = 500 / static_cast<double>(size[1]); - std::cout << "Size: " << size <<std::endl; - std::cout << "Origin: " << origin <<std::endl; - std::cout << "Spacing: " << spacing <<std::endl; + std::cout << "Size: " << size << std::endl; + std::cout << "Origin: " << origin << std::endl; + std::cout << "Spacing: " << spacing << std::endl; typedef otb::VectorDataToImageFilter<VectorDataType, ImageType> VectorDataToImageFilterType; VectorDataToImageFilterType::Pointer vectorDataRendering = VectorDataToImageFilterType::New(); @@ -105,6 +103,5 @@ int otbVectorDataToImageFilterSensorModel(int argc, char * argv[]) writer->SetFileName(argv[3]); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbVectorDataToImageFilterWorld.cxx b/Testing/Code/Common/otbVectorDataToImageFilterWorld.cxx index 0fb700f46b..6fd30d139b 100644 --- a/Testing/Code/Common/otbVectorDataToImageFilterWorld.cxx +++ b/Testing/Code/Common/otbVectorDataToImageFilterWorld.cxx @@ -31,24 +31,23 @@ int otbVectorDataToImageFilterWorld(int argc, char * argv[]) { - if (argc < 10 ) - { - std::cout << argv[0] <<" <input vector filename> <input image filename>" - << " <output vector filename> " - << " <sizeX> <sizeY> " - << " <origin lon> <origin lat> " - << " <spacing lon> <spacing lat> " << std::endl; + if (argc < 10) + { + std::cout << argv[0] << " <input vector filename> <input image filename>" + << " <output vector filename> " + << " <sizeX> <sizeY> " + << " <origin lon> <origin lat> " + << " <spacing lon> <spacing lat> " << std::endl; return EXIT_FAILURE; - } + } //Read the vector data - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; //Reproject the vector data in the proper projection typedef otb::VectorDataProjectionFilter<VectorDataType, VectorDataType> ProjectionFilterType; - VectorDataFileReaderType::Pointer reader0 = VectorDataFileReaderType::New(); reader0->SetFileName(argv[1]); ProjectionFilterType::Pointer projection0 = ProjectionFilterType::New(); @@ -59,10 +58,9 @@ int otbVectorDataToImageFilterWorld(int argc, char * argv[]) ProjectionFilterType::Pointer projection1 = ProjectionFilterType::New(); projection1->SetInput(reader1->GetOutput()); - //Convert the vector data into an image - typedef itk::RGBAPixel< unsigned char > PixelType; - typedef otb::Image<PixelType,2> ImageType; + typedef itk::RGBAPixel<unsigned char> PixelType; + typedef otb::Image<PixelType, 2> ImageType; ImageType::SizeType size; size[0] = atoi(argv[4]); @@ -76,11 +74,10 @@ int otbVectorDataToImageFilterWorld(int argc, char * argv[]) spacing[0] = atof(argv[8]); spacing[1] = atof(argv[9]); - typedef otb::VectorDataToImageFilter<VectorDataType, ImageType> VectorDataToImageFilterType; VectorDataToImageFilterType::Pointer vectorDataRendering = VectorDataToImageFilterType::New(); - vectorDataRendering->SetInput(0,projection0->GetOutput()); - vectorDataRendering->SetInput(1,projection1->GetOutput()); + vectorDataRendering->SetInput(0, projection0->GetOutput()); + vectorDataRendering->SetInput(1, projection1->GetOutput()); vectorDataRendering->SetSize(size); vectorDataRendering->SetOrigin(origin); @@ -96,6 +93,5 @@ int otbVectorDataToImageFilterWorld(int argc, char * argv[]) writer->SetFileName(argv[3]); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbVectorDataToLabelMapFilter.cxx b/Testing/Code/Common/otbVectorDataToLabelMapFilter.cxx index 05708246ad..ab11841220 100644 --- a/Testing/Code/Common/otbVectorDataToLabelMapFilter.cxx +++ b/Testing/Code/Common/otbVectorDataToLabelMapFilter.cxx @@ -34,82 +34,79 @@ int otbVectorDataToLabelMapFilter(int argc, char * argv[]) { - + /** Rasterize vectorData to LabelMap (only available for polygon yet)*/ - if ( argc != 3 ) - { + if (argc != 3) + { std::cerr << "Usage: " << argv[0]; std::cerr << " inputFile(shp) outputLabeledImagefile" << std::endl; return EXIT_FAILURE; - } - + } + const char * infname = argv[1]; const char * outfname = argv[2]; //const char * outvectorfname = argv[3]; - + // Labeled image type const unsigned int Dimension = 2; typedef unsigned short LabelType; - typedef otb::Image<LabelType,Dimension> LabeledImageType; + typedef otb::Image<LabelType, Dimension> LabeledImageType; typedef otb::ImageFileWriter<LabeledImageType> WriterType; - + // Label map typedef - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - - typedef otb::VectorData<double,Dimension> VectorDataType; - typedef otb::VectorDataFileReader<VectorDataType> ReaderType; + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> LabelMapType; + + typedef otb::VectorData<double, Dimension> VectorDataType; + typedef otb::VectorDataFileReader<VectorDataType> ReaderType; typedef otb::VectorDataToLabelMapFilter<VectorDataType, LabelMapType> VectorDataToLabelMapFilterType; - + typedef itk::LabelMapToLabelImageFilter<LabelMapType, LabeledImageType> LabelMapToLabelImageFilterType; - + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); //Update the reader reader->Update(); - + VectorDataToLabelMapFilterType::Pointer myFilter = VectorDataToLabelMapFilterType::New(); myFilter->SetInput(reader->GetOutput()); - - + //TODO Simplify the use of the class VectorDataProperties //VectorDataProperties is needed to compute the ROI of the vectorData typedef otb::VectorDataProperties <VectorDataType> VectorDataPropertiesType; - VectorDataPropertiesType::Pointer p=VectorDataPropertiesType::New(); - //set the input vectordata to the properties properties + VectorDataPropertiesType::Pointer p = VectorDataPropertiesType::New(); + //set the input vectordata to the properties properties p->SetVectorDataObject(reader->GetOutput()); typedef VectorDataType::DataNodeType::PolygonType::RegionType RegionType; RegionType region; typedef RegionType::IndexType index; - typedef RegionType::SizeType size; + typedef RegionType::SizeType size; p->SetBoundingRegion(region); - + //Compute the global bounding box of the vectordata p->ComputeBoundingRegion(); - + LabelMapType::PointType origin; - + origin[0] = p->GetBoundingRegion().GetImageRegion().GetIndex(0); origin[1] = p->GetBoundingRegion().GetImageRegion().GetIndex(1); - + //Set size,origin and spacing of the output labelmap myFilter->SetSize(p->GetBoundingRegion().GetImageRegion().GetSize()); myFilter->SetOrigin(origin); myFilter->SetSpacing(reader->GetOutput()->GetSpacing()); - + // Translate the LabelMap in a labeld image LabelMapToLabelImageFilterType::Pointer labelMapToImageFilter = LabelMapToLabelImageFilterType::New(); labelMapToImageFilter->SetInput(myFilter->GetOutput()); - - - + //Write the result to an image file WriterType::Pointer writer = WriterType::New(); - + writer->SetFileName(outfname); writer->SetInput(labelMapToImageFilter->GetOutput()); writer->Update(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/Common/otbVectorDataToLabelMapFilterNew.cxx b/Testing/Code/Common/otbVectorDataToLabelMapFilterNew.cxx index c0eac8eba9..6cc61f6e7b 100644 --- a/Testing/Code/Common/otbVectorDataToLabelMapFilterNew.cxx +++ b/Testing/Code/Common/otbVectorDataToLabelMapFilterNew.cxx @@ -23,15 +23,13 @@ int otbVectorDataToLabelMapFilterNew(int argc, char * argv[]) { - typedef unsigned short LabelType; + typedef unsigned short LabelType; const unsigned int Dimension = 2; - typedef otb::VectorData<double,Dimension> VectorDataType; - typedef otb::AttributesMapLabelObject<LabelType,Dimension,double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> OutputLabelMapType; - - typedef otb::VectorDataToLabelMapFilter< VectorDataType , OutputLabelMapType > VectorDataToLabelMapFilterType; + typedef otb::VectorData<double, Dimension> VectorDataType; + typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; + typedef itk::LabelMap<LabelObjectType> OutputLabelMapType; - + typedef otb::VectorDataToLabelMapFilter<VectorDataType, OutputLabelMapType> VectorDataToLabelMapFilterType; //Instantiation VectorDataToLabelMapFilterType::Pointer MyFilter = VectorDataToLabelMapFilterType::New(); diff --git a/Testing/Code/Common/otbVectorDataToVectorDataFilterNew.cxx b/Testing/Code/Common/otbVectorDataToVectorDataFilterNew.cxx index 1319832462..296ff8f59b 100644 --- a/Testing/Code/Common/otbVectorDataToVectorDataFilterNew.cxx +++ b/Testing/Code/Common/otbVectorDataToVectorDataFilterNew.cxx @@ -22,16 +22,12 @@ int otbVectorDataToVectorDataFilterNew(int argc, char * argv[]) { + typedef otb::VectorData<double> InputVectorDataType; + typedef otb::VectorData<unsigned char, 2> OutputVectorDataType; - typedef otb::VectorData<double > InputVectorDataType; - typedef otb::VectorData<unsigned char,2 > OutputVectorDataType; - - typedef otb::VectorDataToVectorDataFilter<InputVectorDataType,OutputVectorDataType> VectorDataFilterType; + typedef otb::VectorDataToVectorDataFilter<InputVectorDataType, OutputVectorDataType> VectorDataFilterType; VectorDataFilterType::Pointer vectorData = VectorDataFilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Common/otbVectorImageToASImageAdaptorNew.cxx b/Testing/Code/Common/otbVectorImageToASImageAdaptorNew.cxx index f004e39bf0..a573a9fcd1 100644 --- a/Testing/Code/Common/otbVectorImageToASImageAdaptorNew.cxx +++ b/Testing/Code/Common/otbVectorImageToASImageAdaptorNew.cxx @@ -29,6 +29,5 @@ int otbVectorImageToASImageAdaptorNew(int argc, char * argv[]) // Instantiating object FilterType::Pointer object = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbBSplinesInterpolateDeformationFieldGenerator.cxx b/Testing/Code/DisparityMap/otbBSplinesInterpolateDeformationFieldGenerator.cxx index 952bae6857..d25c72bd3a 100644 --- a/Testing/Code/DisparityMap/otbBSplinesInterpolateDeformationFieldGenerator.cxx +++ b/Testing/Code/DisparityMap/otbBSplinesInterpolateDeformationFieldGenerator.cxx @@ -24,23 +24,23 @@ int otbBSplinesInterpolateDeformationFieldGenerator(int argc, char * argv[]) { const unsigned int Dimension = 2; - const char * outfname = argv[1]; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef itk::Array<double> ParamType; - typedef itk::PointSet<ParamType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType,ImageType> FilterType; - typedef otb::ImageFileWriter<ImageType> WriterType; + const char * outfname = argv[1]; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef itk::Array<double> ParamType; + typedef itk::PointSet<ParamType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType, ImageType> FilterType; + typedef otb::ImageFileWriter<ImageType> WriterType; ImageType::SizeType size; size.Fill(100); double thresh = 0.9; // Preparing point set - PointSetType::Pointer ps = PointSetType::New(); - PointType p1,p2,p3,p4,p5; - ParamType pd1(3),pd2(3),pd3(3),pd4(3),pd5(3); + PointSetType::Pointer ps = PointSetType::New(); + PointType p1, p2, p3, p4, p5; + ParamType pd1(3), pd2(3), pd3(3), pd4(3), pd5(3); p1[0] = 10; p1[1] = 10; @@ -69,17 +69,16 @@ int otbBSplinesInterpolateDeformationFieldGenerator(int argc, char * argv[]) pd5[1] = 5; pd5[2] = 5; - ps->SetPoint(0,p1); - ps->SetPointData(0,pd1); - ps->SetPoint(1,p2); - ps->SetPointData(1,pd2); - ps->SetPoint(2,p3); - ps->SetPointData(2,pd3); - ps->SetPoint(3,p4); - ps->SetPointData(3,pd4); - ps->SetPoint(4,p5); - ps->SetPointData(4,pd5); - + ps->SetPoint(0, p1); + ps->SetPointData(0, pd1); + ps->SetPoint(1, p2); + ps->SetPointData(1, pd2); + ps->SetPoint(2, p3); + ps->SetPointData(2, pd3); + ps->SetPoint(3, p4); + ps->SetPointData(3, pd4); + ps->SetPoint(4, p5); + ps->SetPointData(4, pd5); // Instantiating object FilterType::Pointer filter = FilterType::New(); @@ -92,6 +91,5 @@ int otbBSplinesInterpolateDeformationFieldGenerator(int argc, char * argv[]) writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbBSplinesInterpolateDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbBSplinesInterpolateDeformationFieldGeneratorNew.cxx index 787951a9c2..9bdbe8756e 100644 --- a/Testing/Code/DisparityMap/otbBSplinesInterpolateDeformationFieldGeneratorNew.cxx +++ b/Testing/Code/DisparityMap/otbBSplinesInterpolateDeformationFieldGeneratorNew.cxx @@ -23,15 +23,14 @@ int otbBSplinesInterpolateDeformationFieldGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef ImageType::PointType PointType; - typedef itk::PointSet<PointType,Dimension> PointSetType; - typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType,ImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PointType PointType; + typedef itk::PointSet<PointType, Dimension> PointSetType; + typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDeformationFieldGenerator.cxx b/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDeformationFieldGenerator.cxx index 2455c7348a..0821e30f9b 100644 --- a/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDeformationFieldGenerator.cxx +++ b/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDeformationFieldGenerator.cxx @@ -25,25 +25,25 @@ int otbBSplinesInterpolateTransformDeformationFieldGenerator(int argc, char * argv[]) { const unsigned int Dimension = 2; - const char * outfname = argv[1]; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef itk::Array<double> ParamType; - typedef itk::PointSet<ParamType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType,ImageType> FilterType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::Euler2DTransform<double> TransformType; + const char * outfname = argv[1]; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef itk::Array<double> ParamType; + typedef itk::PointSet<ParamType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType, ImageType> FilterType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::Euler2DTransform<double> TransformType; ImageType::SizeType size; size.Fill(100); double thresh = 0.9; // Preparing point set - PointSetType::Pointer ps = PointSetType::New(); - PointType p1,p2,p3,p4,p5; - ParamType pd1(6),pd2(6),pd3(6),pd4(6),pd5(6); - itk::Point<double,2> center; + PointSetType::Pointer ps = PointSetType::New(); + PointType p1, p2, p3, p4, p5; + ParamType pd1(6), pd2(6), pd3(6), pd4(6), pd5(6); + itk::Point<double, 2> center; p1[0] = 10; p1[1] = 10; @@ -88,17 +88,16 @@ int otbBSplinesInterpolateTransformDeformationFieldGenerator(int argc, char * ar pd5[4] = -5; pd5[5] = -5; - - ps->SetPoint(0,p1); - ps->SetPointData(0,pd1); - ps->SetPoint(1,p2); - ps->SetPointData(1,pd2); - ps->SetPoint(2,p3); - ps->SetPointData(2,pd3); - ps->SetPoint(3,p4); - ps->SetPointData(3,pd4); - ps->SetPoint(4,p5); - ps->SetPointData(4,pd5); + ps->SetPoint(0, p1); + ps->SetPointData(0, pd1); + ps->SetPoint(1, p2); + ps->SetPointData(1, pd2); + ps->SetPoint(2, p3); + ps->SetPointData(2, pd3); + ps->SetPoint(3, p4); + ps->SetPointData(3, pd4); + ps->SetPoint(4, p5); + ps->SetPointData(4, pd5); TransformType::Pointer transform = TransformType::New(); transform->SetCenter(center); @@ -116,6 +115,5 @@ int otbBSplinesInterpolateTransformDeformationFieldGenerator(int argc, char * ar writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDeformationFieldGeneratorNew.cxx index 9021840ae5..b3f1dbc8c1 100644 --- a/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDeformationFieldGeneratorNew.cxx +++ b/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDeformationFieldGeneratorNew.cxx @@ -23,15 +23,14 @@ int otbBSplinesInterpolateTransformDeformationFieldGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef itk::Array<double> ParametersType; - typedef itk::PointSet<ParametersType,Dimension> PointSetType; - typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType,ImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef itk::Array<double> ParametersType; + typedef itk::PointSet<ParametersType, Dimension> PointSetType; + typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbCenteredRigidDeformationFieldEstimation.cxx b/Testing/Code/DisparityMap/otbCenteredRigidDeformationFieldEstimation.cxx index 0089d90df7..96b2803ae5 100644 --- a/Testing/Code/DisparityMap/otbCenteredRigidDeformationFieldEstimation.cxx +++ b/Testing/Code/DisparityMap/otbCenteredRigidDeformationFieldEstimation.cxx @@ -35,84 +35,99 @@ #include "otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.h" #include "otbBSplinesInterpolateTransformDeformationFieldGenerator.h" - int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) { - if (argc!=13) - { - std::cout<<"usage: "<<argv[0]<<" fixedFileName movingFileName outputFileName explorationSize windowSize learningRate numberOfIterations metricThreshold nbPointToInterpolate pontsetStep centerx centery"<<std::endl; + if (argc != 13) + { + std::cout << "usage: " << argv[0] << + " fixedFileName movingFileName outputFileName explorationSize windowSize learningRate numberOfIterations metricThreshold nbPointToInterpolate pontsetStep centerx centery" + << std::endl; return EXIT_SUCCESS; - } + } // Input parameters - const char* fixedFileName = argv[1]; - const char* movingFileName = argv[2]; - const char* outputFileNamePrefix = argv[3]; + const char* fixedFileName = argv[1]; + const char* movingFileName = argv[2]; + const char* outputFileNamePrefix = argv[3]; const unsigned int exploSize = atoi(argv[4]); const unsigned int winSize = atoi(argv[5]); - const double learningRate = atof(argv[6]); + const double learningRate = atof(argv[6]); const unsigned int niterations = atoi(argv[7]); - const double metricThreshold = atof(argv[8]); + const double metricThreshold = atof(argv[8]); const unsigned int nbPointsToInterpolate = atoi(argv[9]); const unsigned int step = atoi(argv[10]); - const double centerx = atof(argv[11]); - const double centery = atof(argv[12]); + const double centerx = atof(argv[11]); + const double centery = atof(argv[12]); // 0. DEFINTIONS // Images definition - const unsigned int Dimension=2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef ImageType::IndexType IndexType; - typedef ImageType::SizeType SizeType; - typedef otb::VectorImage<double,Dimension> DeformationFieldType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef ImageType::IndexType IndexType; + typedef ImageType::SizeType SizeType; + typedef otb::VectorImage<double, Dimension> DeformationFieldType; // Transform definition typedef itk::CenteredRigid2DTransform<double> TransformType; - typedef TransformType::ParametersType ParametersType; + typedef TransformType::ParametersType ParametersType; // Pointset definition - typedef itk::PointSet<ParametersType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; - typedef PointSetType::PointsContainer PointsContainerType; + typedef itk::PointSet<ParametersType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; typedef PointSetType::PointDataContainer::Iterator PointDataIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; + typedef PointSetType::PointDataContainer PointDataContainerType; // Disparity map estimator definition - typedef otb::DisparityMapEstimationMethod<ImageType,ImageType,PointSetType> DMEstimationType; + typedef otb::DisparityMapEstimationMethod<ImageType, ImageType, PointSetType> DMEstimationType; // Metric definition - typedef itk::NormalizedCorrelationImageToImageMetric<ImageType,ImageType> MetricType; + typedef itk::NormalizedCorrelationImageToImageMetric<ImageType, ImageType> MetricType; // Interpolator definition - typedef itk::Function::HammingWindowFunction<3> WindowFunctionType; - typedef itk::ZeroFluxNeumannBoundaryCondition<ImageType> ConditionType; - typedef itk::WindowedSincInterpolateImageFunction<ImageType,3,WindowFunctionType,ConditionType ,double> InterpolatorType; + typedef itk::Function::HammingWindowFunction<3> + WindowFunctionType; + typedef itk::ZeroFluxNeumannBoundaryCondition<ImageType> + ConditionType; + typedef itk::WindowedSincInterpolateImageFunction<ImageType, 3, WindowFunctionType, ConditionType, + double> InterpolatorType; // Optimizer definition typedef itk::GradientDescentOptimizer OptimizerType; // IO definition - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; typedef otb::ImageFileWriter<DeformationFieldType> DeformationFieldWriterType; // Additional filters - typedef itk::RescaleIntensityImageFilter<ImageType,OutputImageType> RescalerType; + typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescalerType; // Deformation fields generator - typedef otb::NearestPointDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestPointGeneratorType; - typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestPointGeneratorType; - typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesGeneratorType; - typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestTransformGeneratorType; - typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestTransformGeneratorType; - typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesTransformGeneratorType; + typedef otb::NearestPointDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NearestPointGeneratorType; + typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NNearestPointGeneratorType; + typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> BSplinesGeneratorType; + typedef otb::NearestTransformDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NearestTransformGeneratorType; + typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NNearestTransformGeneratorType; + typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType, + DeformationFieldType> + BSplinesTransformGeneratorType; // Warper - typedef itk::WarpImageFilter<ImageType,ImageType,DeformationFieldType> ImageWarperType; + typedef itk::WarpImageFilter<ImageType, ImageType, DeformationFieldType> ImageWarperType; //Input images reading ReaderType::Pointer fixedReader = ReaderType::New(); @@ -124,40 +139,40 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) movingReader->Update(); // 1. POINTSET CREATION - SizeType fixedSize = fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize(); - unsigned int NumberOfXNodes = (fixedSize[0]-2*exploSize-1)/step; - unsigned int NumberOfYNodes = (fixedSize[1]-2*exploSize-1)/step; - unsigned int NumberOfNodes = NumberOfXNodes*NumberOfYNodes; + SizeType fixedSize = fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize(); + unsigned int NumberOfXNodes = (fixedSize[0] - 2 * exploSize - 1) / step; + unsigned int NumberOfYNodes = (fixedSize[1] - 2 * exploSize - 1) / step; + unsigned int NumberOfNodes = NumberOfXNodes * NumberOfYNodes; - std::cout<<"PointSet size: "<<NumberOfNodes<<std::endl; + std::cout << "PointSet size: " << NumberOfNodes << std::endl; IndexType firstNodeIndex; firstNodeIndex[0] = exploSize; firstNodeIndex[1] = exploSize; - PointSetType::Pointer nodes = PointSetType::New(); - unsigned int nodeCounter = 0; + PointSetType::Pointer nodes = PointSetType::New(); + unsigned int nodeCounter = 0; std::cout << "Node coordinates : " << std::endl; - for (unsigned int x=0; x<NumberOfXNodes; x++) - for (unsigned int y=0; y<NumberOfYNodes; y++) - { + for (unsigned int x = 0; x < NumberOfXNodes; x++) + for (unsigned int y = 0; y < NumberOfYNodes; y++) + { PointType p; - p[0] = firstNodeIndex[0]+x*step; // x coordinate - p[1] = firstNodeIndex[1]+y*step; // y coordinate + p[0] = firstNodeIndex[0] + x * step; // x coordinate + p[1] = firstNodeIndex[1] + y * step; // y coordinate std::cout << "Id: " << nodeCounter << " -> " << p << std::endl; - nodes->SetPoint( nodeCounter++, p ); - } + nodes->SetPoint(nodeCounter++, p); + } // Fix to avoid recomputing the disparity for each deformation field generation method. nodes->SetBufferedRegion(0); // 2. DISPARITY MAP ESTIMATION DMEstimationType::Pointer dmestimator = DMEstimationType::New(); - TransformType::Pointer transform = TransformType::New(); - OptimizerType::Pointer optimizer = OptimizerType::New(); + TransformType::Pointer transform = TransformType::New(); + OptimizerType::Pointer optimizer = OptimizerType::New(); InterpolatorType::Pointer interpolator = InterpolatorType::New(); - MetricType::Pointer metric = MetricType::New(); + MetricType::Pointer metric = MetricType::New(); metric->SetSubtractMean(true); optimizer->MinimizeOn(); OptimizerType::ScalesType scales(transform->GetNumberOfParameters()); @@ -175,9 +190,9 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) dmestimator->SetMetric(metric); // For gradient descent - optimizer->SetLearningRate( learningRate ); - optimizer->SetNumberOfIterations( niterations ); - DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters() ); + optimizer->SetLearningRate(learningRate); + optimizer->SetNumberOfIterations(niterations); + DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters()); initialParameters[0] = 0.0; // Initial angle initialParameters[1] = centerx; // x initial center initialParameters[2] = centery; // y initial center @@ -187,7 +202,7 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) dmestimator->SetInitialTransformParameters(initialParameters); // inputs wiring - ImageType::SizeType win,explo; + ImageType::SizeType win, explo; win.Fill(winSize); explo.Fill(exploSize); @@ -199,11 +214,11 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) dmestimator->SetInitialTransformParameters(initialParameters); // 3. DEFORMATION FIELDS COMPUTATION - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); DeformationFieldWriterType::Pointer dfwriter = DeformationFieldWriterType::New(); - ImageWarperType::Pointer warper = ImageWarperType::New(); - RescalerType::Pointer rescaler = RescalerType::New(); - itk::OStringStream oss; + ImageWarperType::Pointer warper = ImageWarperType::New(); + RescalerType::Pointer rescaler = RescalerType::New(); + itk::OStringStream oss; //3.a Nearest point deformation field generator NearestPointGeneratorType::Pointer generator1 = NearestPointGeneratorType::New(); @@ -221,13 +236,13 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_np_df.hdr"; + oss << outputFileNamePrefix << "_np_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator1->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_np_oi.tif"; + oss << outputFileNamePrefix << "_np_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -246,7 +261,6 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) generator2->SetMetricThreshold(metricThreshold); generator2->SetNumberOfPoints(nbPointsToInterpolate); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator2->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -255,13 +269,13 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnp_df.hdr"; + oss << outputFileNamePrefix << "_nnp_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator2->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnp_oi.tif"; + oss << outputFileNamePrefix << "_nnp_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -279,7 +293,6 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) generator3->SetOutputSize(fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize()); generator3->SetMetricThreshold(metricThreshold); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator3->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -288,13 +301,13 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bs_df.hdr"; + oss << outputFileNamePrefix << "_bs_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator3->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bs_oi.tif"; + oss << outputFileNamePrefix << "_bs_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -321,13 +334,13 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nt_df.hdr"; + oss << outputFileNamePrefix << "_nt_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator4->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nt_oi.tif"; + oss << outputFileNamePrefix << "_nt_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -355,13 +368,13 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnt_df.hdr"; + oss << outputFileNamePrefix << "_nnt_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator5->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnt_oi.tif"; + oss << outputFileNamePrefix << "_nnt_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -382,7 +395,6 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) generator6->SetSplineOrder(4); generator6->SetNumberOfControlPoints(5); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator6->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -391,17 +403,16 @@ int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bst_df.hdr"; + oss << outputFileNamePrefix << "_bst_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator6->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bst_oi.tif"; + oss << outputFileNamePrefix << "_bst_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbDisparityMapEstimationMethod.cxx b/Testing/Code/DisparityMap/otbDisparityMapEstimationMethod.cxx index 3584b185fe..856869a299 100644 --- a/Testing/Code/DisparityMap/otbDisparityMapEstimationMethod.cxx +++ b/Testing/Code/DisparityMap/otbDisparityMapEstimationMethod.cxx @@ -25,33 +25,32 @@ #include "otbThresholdImageToPointSetFilter.h" #include "itkMinimumMaximumImageCalculator.h" - int otbDisparityMapEstimationMethod(int argc, char* argv[]) { - const char* fixedFileName = argv[1]; - const char* movingFileName = argv[2]; - const char* pointSetFileName = argv[3]; - const char* outputFileName = argv[4]; + const char* fixedFileName = argv[1]; + const char* movingFileName = argv[2]; + const char* pointSetFileName = argv[3]; + const char* outputFileName = argv[4]; const unsigned int exploSize = atoi(argv[5]); const unsigned int winSize = atoi(argv[6]); - const unsigned int Dimension=2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - - typedef itk::TranslationTransform<double,Dimension> TransformType; - typedef TransformType::ParametersType ParametersType; - typedef itk::PointSet<ParametersType,Dimension> PointSetType; - typedef otb::DisparityMapEstimationMethod<ImageType,ImageType,PointSetType> DMEstimationType; - typedef itk::NormalizedCorrelationImageToImageMetric<ImageType,ImageType> MetricType; - typedef itk::LinearInterpolateImageFunction<ImageType,double> InterpolatorType; - typedef itk::GradientDescentOptimizer OptimizerType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ThresholdImageToPointSetFilter<ImageType,PointSetType> PointSetSourceType; - typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointSetType::PointDataContainer::Iterator PointDataIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + + typedef itk::TranslationTransform<double, Dimension> TransformType; + typedef TransformType::ParametersType ParametersType; + typedef itk::PointSet<ParametersType, Dimension> PointSetType; + typedef otb::DisparityMapEstimationMethod<ImageType, ImageType, PointSetType> DMEstimationType; + typedef itk::NormalizedCorrelationImageToImageMetric<ImageType, ImageType> MetricType; + typedef itk::LinearInterpolateImageFunction<ImageType, double> InterpolatorType; + typedef itk::GradientDescentOptimizer OptimizerType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ThresholdImageToPointSetFilter<ImageType, PointSetType> PointSetSourceType; + typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef PointSetType::PointDataContainer::Iterator PointDataIteratorType; + typedef PointSetType::PointDataContainer PointDataContainerType; //Input images reading ReaderType::Pointer fixedReader = ReaderType::New(); @@ -71,23 +70,22 @@ int otbDisparityMapEstimationMethod(int argc, char* argv[]) mm->SetImage(pointSetReader->GetOutput()); mm->ComputeMinimum(); mm->ComputeMaximum(); - std::cout<<"min: "<<(int)mm->GetMinimum()<<" max: "<<(int)mm->GetMaximum()<<std::endl; - + std::cout << "min: " << (int) mm->GetMinimum() << " max: " << (int) mm->GetMaximum() << std::endl; PointSetSourceType::Pointer pointSetSource = PointSetSourceType::New(); pointSetSource->SetLowerThreshold(mm->GetMaximum()); pointSetSource->SetUpperThreshold(mm->GetMaximum()); - pointSetSource->SetInput(0,pointSetReader->GetOutput()); + pointSetSource->SetInput(0, pointSetReader->GetOutput()); pointSetSource->Update(); - std::cout<<"PointSet size: "<<pointSetSource->GetOutput()->GetPoints()->Size()<<std::endl; + std::cout << "PointSet size: " << pointSetSource->GetOutput()->GetPoints()->Size() << std::endl; // Instantiation DMEstimationType::Pointer dmestimator = DMEstimationType::New(); - TransformType::Pointer transform = TransformType::New(); - OptimizerType::Pointer optimizer = OptimizerType::New(); + TransformType::Pointer transform = TransformType::New(); + OptimizerType::Pointer optimizer = OptimizerType::New(); InterpolatorType::Pointer interpolator = InterpolatorType::New(); - MetricType::Pointer metric = MetricType::New(); + MetricType::Pointer metric = MetricType::New(); // Set up dmestimator->SetTransform(transform); @@ -96,9 +94,9 @@ int otbDisparityMapEstimationMethod(int argc, char* argv[]) dmestimator->SetMetric(metric); // For gradient descent - optimizer->SetLearningRate( 5.0 ); - optimizer->SetNumberOfIterations( 600 ); - DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters() ); + optimizer->SetLearningRate(5.0); + optimizer->SetNumberOfIterations(600); + DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters()); initialParameters[0] = 0.0; // Initial offset in mm along X initialParameters[1] = 0.0; // Initial offset in mm along Y @@ -106,7 +104,7 @@ int otbDisparityMapEstimationMethod(int argc, char* argv[]) // dmestimator->SetInitialTransformParameters(initialParameters); // inputs wiring - ImageType::SizeType win,explo; + ImageType::SizeType win, explo; win.Fill(winSize); explo.Fill(exploSize); @@ -124,26 +122,25 @@ int otbDisparityMapEstimationMethod(int argc, char* argv[]) // Writing output transform parameters std::ofstream out; - out.open(outputFileName,std::ios::out); + out.open(outputFileName, std::ios::out); out.setf(std::ios::fixed); // out.setprecision(10); PointSetIteratorType it = pointSet->GetPoints()->Begin(); // unsigned int idData=0; PointDataIteratorType itData = pointSet->GetPointData()->Begin(); - std::cout<<"Point data size: "<<pointSet->GetPointData()->Size()<<std::endl; + std::cout << "Point data size: " << pointSet->GetPointData()->Size() << std::endl; for (; - it!=pointSet->GetPoints()->End() - &&itData!=pointSet->GetPointData()->End(); - ++it,++itData) - { - out<<"Point "<<it.Value()<<" -> transform parameters: "; - out<<itData.Value(); - out<<std::endl; - - } + it != pointSet->GetPoints()->End() + && itData != pointSet->GetPointData()->End(); + ++it, ++itData) + { + out << "Point " << it.Value() << " -> transform parameters: "; + out << itData.Value(); + out << std::endl; + + } out.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbDisparityMapEstimationMethodNew.cxx b/Testing/Code/DisparityMap/otbDisparityMapEstimationMethodNew.cxx index 597687e89a..6ea001e23e 100644 --- a/Testing/Code/DisparityMap/otbDisparityMapEstimationMethodNew.cxx +++ b/Testing/Code/DisparityMap/otbDisparityMapEstimationMethodNew.cxx @@ -22,17 +22,16 @@ int otbDisparityMapEstimationMethodNew(int argc, char* argv[]) { - const unsigned int Dimension=2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::TranslationTransform<double,Dimension> TransformType; - typedef TransformType::ParametersType ParametersType; - typedef itk::PointSet<ParametersType,Dimension> PointSetType; - typedef otb::DisparityMapEstimationMethod<ImageType,ImageType,PointSetType> DMEstimationType; + const unsigned int Dimension = 2; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::TranslationTransform<double, Dimension> TransformType; + typedef TransformType::ParametersType ParametersType; + typedef itk::PointSet<ParametersType, Dimension> PointSetType; + typedef otb::DisparityMapEstimationMethod<ImageType, ImageType, PointSetType> DMEstimationType; // Instantiation DMEstimationType::Pointer dmestimator = DMEstimationType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbEuler2DDeformationFieldEstimation.cxx b/Testing/Code/DisparityMap/otbEuler2DDeformationFieldEstimation.cxx index c4591d6f12..6196b0e472 100644 --- a/Testing/Code/DisparityMap/otbEuler2DDeformationFieldEstimation.cxx +++ b/Testing/Code/DisparityMap/otbEuler2DDeformationFieldEstimation.cxx @@ -35,84 +35,99 @@ #include "otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.h" #include "otbBSplinesInterpolateTransformDeformationFieldGenerator.h" - int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) { - if (argc!=13) - { - std::cout<<"usage: "<<argv[0]<<" fixedFileName movingFileName outputFileName explorationSize windowSize learningRate numberOfIterations metricThreshold nbPointToInterpolate pontsetStep centerx centery"<<std::endl; + if (argc != 13) + { + std::cout << "usage: " << argv[0] << + " fixedFileName movingFileName outputFileName explorationSize windowSize learningRate numberOfIterations metricThreshold nbPointToInterpolate pontsetStep centerx centery" + << std::endl; return EXIT_SUCCESS; - } + } // Input parameters - const char* fixedFileName = argv[1]; - const char* movingFileName = argv[2]; - const char* outputFileNamePrefix = argv[3]; + const char* fixedFileName = argv[1]; + const char* movingFileName = argv[2]; + const char* outputFileNamePrefix = argv[3]; const unsigned int exploSize = atoi(argv[4]); const unsigned int winSize = atoi(argv[5]); - const double learningRate = atof(argv[6]); + const double learningRate = atof(argv[6]); const unsigned int niterations = atoi(argv[7]); - const double metricThreshold = atof(argv[8]); + const double metricThreshold = atof(argv[8]); const unsigned int nbPointsToInterpolate = atoi(argv[9]); const unsigned int step = atoi(argv[10]); - const double centerx = atof(argv[11]); - const double centery = atof(argv[12]); + const double centerx = atof(argv[11]); + const double centery = atof(argv[12]); // 0. DEFINTIONS // Images definition - const unsigned int Dimension=2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef ImageType::IndexType IndexType; - typedef ImageType::SizeType SizeType; - typedef otb::VectorImage<double,Dimension> DeformationFieldType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef ImageType::IndexType IndexType; + typedef ImageType::SizeType SizeType; + typedef otb::VectorImage<double, Dimension> DeformationFieldType; // Transform definition typedef itk::Euler2DTransform<double> TransformType; typedef TransformType::ParametersType ParametersType; // Pointset definition - typedef itk::PointSet<ParametersType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; - typedef PointSetType::PointsContainer PointsContainerType; + typedef itk::PointSet<ParametersType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; typedef PointSetType::PointDataContainer::Iterator PointDataIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; + typedef PointSetType::PointDataContainer PointDataContainerType; // Disparity map estimator definition - typedef otb::DisparityMapEstimationMethod<ImageType,ImageType,PointSetType> DMEstimationType; + typedef otb::DisparityMapEstimationMethod<ImageType, ImageType, PointSetType> DMEstimationType; // Metric definition - typedef itk::NormalizedCorrelationImageToImageMetric<ImageType,ImageType> MetricType; + typedef itk::NormalizedCorrelationImageToImageMetric<ImageType, ImageType> MetricType; // Interpolator definition - typedef itk::Function::HammingWindowFunction<3> WindowFunctionType; - typedef itk::ZeroFluxNeumannBoundaryCondition<ImageType> ConditionType; - typedef itk::WindowedSincInterpolateImageFunction<ImageType,3,WindowFunctionType,ConditionType ,double> InterpolatorType; + typedef itk::Function::HammingWindowFunction<3> + WindowFunctionType; + typedef itk::ZeroFluxNeumannBoundaryCondition<ImageType> + ConditionType; + typedef itk::WindowedSincInterpolateImageFunction<ImageType, 3, WindowFunctionType, ConditionType, + double> InterpolatorType; // Optimizer definition typedef itk::GradientDescentOptimizer OptimizerType; // IO definition - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; typedef otb::ImageFileWriter<DeformationFieldType> DeformationFieldWriterType; // Additional filters - typedef itk::RescaleIntensityImageFilter<ImageType,OutputImageType> RescalerType; + typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescalerType; // Deformation fields generator - typedef otb::NearestPointDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestPointGeneratorType; - typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestPointGeneratorType; - typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesGeneratorType; - typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestTransformGeneratorType; - typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestTransformGeneratorType; - typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesTransformGeneratorType; + typedef otb::NearestPointDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NearestPointGeneratorType; + typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NNearestPointGeneratorType; + typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> BSplinesGeneratorType; + typedef otb::NearestTransformDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NearestTransformGeneratorType; + typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NNearestTransformGeneratorType; + typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType, + DeformationFieldType> + BSplinesTransformGeneratorType; // Warper - typedef itk::WarpImageFilter<ImageType,ImageType,DeformationFieldType> ImageWarperType; + typedef itk::WarpImageFilter<ImageType, ImageType, DeformationFieldType> ImageWarperType; //Input images reading ReaderType::Pointer fixedReader = ReaderType::New(); @@ -124,40 +139,40 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) movingReader->Update(); // 1. POINTSET CREATION - SizeType fixedSize = fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize(); - unsigned int NumberOfXNodes = (fixedSize[0]-2*exploSize-1)/step; - unsigned int NumberOfYNodes = (fixedSize[1]-2*exploSize-1)/step; - unsigned int NumberOfNodes = NumberOfXNodes*NumberOfYNodes; + SizeType fixedSize = fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize(); + unsigned int NumberOfXNodes = (fixedSize[0] - 2 * exploSize - 1) / step; + unsigned int NumberOfYNodes = (fixedSize[1] - 2 * exploSize - 1) / step; + unsigned int NumberOfNodes = NumberOfXNodes * NumberOfYNodes; - std::cout<<"PointSet size: "<<NumberOfNodes<<std::endl; + std::cout << "PointSet size: " << NumberOfNodes << std::endl; IndexType firstNodeIndex; firstNodeIndex[0] = exploSize; firstNodeIndex[1] = exploSize; - PointSetType::Pointer nodes = PointSetType::New(); - unsigned int nodeCounter = 0; + PointSetType::Pointer nodes = PointSetType::New(); + unsigned int nodeCounter = 0; std::cout << "Node coordinates : " << std::endl; - for (unsigned int x=0; x<NumberOfXNodes; x++) - for (unsigned int y=0; y<NumberOfYNodes; y++) - { + for (unsigned int x = 0; x < NumberOfXNodes; x++) + for (unsigned int y = 0; y < NumberOfYNodes; y++) + { PointType p; - p[0] = firstNodeIndex[0]+x*step; // x coordinate - p[1] = firstNodeIndex[1]+y*step; // y coordinate + p[0] = firstNodeIndex[0] + x * step; // x coordinate + p[1] = firstNodeIndex[1] + y * step; // y coordinate std::cout << "Id: " << nodeCounter << " -> " << p << std::endl; - nodes->SetPoint( nodeCounter++, p ); - } + nodes->SetPoint(nodeCounter++, p); + } // Fix to avoid recomputing the disparity for each deformation field generation method. nodes->SetBufferedRegion(0); // 2. DISPARITY MAP ESTIMATION DMEstimationType::Pointer dmestimator = DMEstimationType::New(); - TransformType::Pointer transform = TransformType::New(); - OptimizerType::Pointer optimizer = OptimizerType::New(); + TransformType::Pointer transform = TransformType::New(); + OptimizerType::Pointer optimizer = OptimizerType::New(); InterpolatorType::Pointer interpolator = InterpolatorType::New(); - MetricType::Pointer metric = MetricType::New(); + MetricType::Pointer metric = MetricType::New(); metric->SetSubtractMean(true); optimizer->MinimizeOn(); OptimizerType::ScalesType scales(3); @@ -179,9 +194,9 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) dmestimator->SetMetric(metric); // For gradient descent - optimizer->SetLearningRate( learningRate ); - optimizer->SetNumberOfIterations( niterations ); - DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters() ); + optimizer->SetLearningRate(learningRate); + optimizer->SetNumberOfIterations(niterations); + DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters()); initialParameters[0] = 0.0; // Initial angle initialParameters[1] = 0.0; // Initial offset in mm along X initialParameters[2] = 0.0; // Initial offset in mm along Y @@ -189,7 +204,7 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) dmestimator->SetInitialTransformParameters(initialParameters); // inputs wiring - ImageType::SizeType win,explo; + ImageType::SizeType win, explo; win.Fill(winSize); explo.Fill(exploSize); @@ -201,11 +216,11 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) dmestimator->SetInitialTransformParameters(initialParameters); // 3. DEFORMATION FIELDS COMPUTATION - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); DeformationFieldWriterType::Pointer dfwriter = DeformationFieldWriterType::New(); - ImageWarperType::Pointer warper = ImageWarperType::New(); - RescalerType::Pointer rescaler = RescalerType::New(); - itk::OStringStream oss; + ImageWarperType::Pointer warper = ImageWarperType::New(); + RescalerType::Pointer rescaler = RescalerType::New(); + itk::OStringStream oss; //3.a Nearest point deformation field generator NearestPointGeneratorType::Pointer generator1 = NearestPointGeneratorType::New(); @@ -223,13 +238,13 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_np_df.hdr"; + oss << outputFileNamePrefix << "_np_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator1->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_np_oi.tif"; + oss << outputFileNamePrefix << "_np_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -248,7 +263,6 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) generator2->SetMetricThreshold(metricThreshold); generator2->SetNumberOfPoints(nbPointsToInterpolate); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator2->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -257,13 +271,13 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnp_df.hdr"; + oss << outputFileNamePrefix << "_nnp_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator2->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnp_oi.tif"; + oss << outputFileNamePrefix << "_nnp_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -281,7 +295,6 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) generator3->SetOutputSize(fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize()); generator3->SetMetricThreshold(metricThreshold); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator3->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -290,13 +303,13 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bs_df.hdr"; + oss << outputFileNamePrefix << "_bs_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator3->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bs_oi.tif"; + oss << outputFileNamePrefix << "_bs_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -323,13 +336,13 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nt_df.hdr"; + oss << outputFileNamePrefix << "_nt_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator4->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nt_oi.tif"; + oss << outputFileNamePrefix << "_nt_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -357,13 +370,13 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnt_df.hdr"; + oss << outputFileNamePrefix << "_nnt_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator5->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnt_oi.tif"; + oss << outputFileNamePrefix << "_nnt_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -384,7 +397,6 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) generator6->SetSplineOrder(4); generator6->SetNumberOfControlPoints(5); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator6->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -393,17 +405,16 @@ int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) rescaler->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bst_df.hdr"; + oss << outputFileNamePrefix << "_bst_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator6->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bst_oi.tif"; + oss << outputFileNamePrefix << "_bst_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbNCCRegistrationFilter.cxx b/Testing/Code/DisparityMap/otbNCCRegistrationFilter.cxx index f02102e1ae..9b9102253b 100644 --- a/Testing/Code/DisparityMap/otbNCCRegistrationFilter.cxx +++ b/Testing/Code/DisparityMap/otbNCCRegistrationFilter.cxx @@ -22,61 +22,61 @@ #include "otbNCCRegistrationFilter.h" #include "itkRecursiveGaussianImageFilter.h" -int otbNCCRegistrationFilter(int argc, char* argv []) +int otbNCCRegistrationFilter(int argc, char* argv[]) { - if (argc!= 7) - { - std::cerr <<"Usage: "<<argv[0]; - std::cerr<<" fixedFileName movingFileName fieldOutName"; - std::cerr<<"explorationSize bluringSigma nbIterations "; + if (argc != 7) + { + std::cerr << "Usage: " << argv[0]; + std::cerr << " fixedFileName movingFileName fieldOutName"; + std::cerr << "explorationSize bluringSigma nbIterations "; return EXIT_FAILURE; - } + } const unsigned int ImageDimension = 2; - typedef double PixelType; - typedef itk::Vector<double,ImageDimension> DeformationPixelType; - typedef double CoordinateRepresentationType; - typedef double OutputPixelType; - typedef otb::Image<OutputPixelType,ImageDimension> OutputImageType; - typedef otb::Image<PixelType,ImageDimension> MovingImageType; - typedef otb::Image<PixelType,ImageDimension> FixedImageType; + typedef double PixelType; + typedef itk::Vector<double, ImageDimension> DeformationPixelType; + typedef double CoordinateRepresentationType; + typedef double OutputPixelType; + typedef otb::Image<OutputPixelType, ImageDimension> OutputImageType; + typedef otb::Image<PixelType, ImageDimension> MovingImageType; + typedef otb::Image<PixelType, ImageDimension> FixedImageType; typedef otb::Image<DeformationPixelType, - ImageDimension> DeformationFieldType; + ImageDimension> DeformationFieldType; - typedef otb::ImageFileReader< FixedImageType > FixedReaderType; + typedef otb::ImageFileReader<FixedImageType> FixedReaderType; FixedReaderType::Pointer fReader = FixedReaderType::New(); fReader->SetFileName(argv[1]); - typedef otb::ImageFileReader< MovingImageType > MovingReaderType; + typedef otb::ImageFileReader<MovingImageType> MovingReaderType; MovingReaderType::Pointer mReader = MovingReaderType::New(); mReader->SetFileName(argv[2]); - typedef itk::RecursiveGaussianImageFilter< FixedImageType, - FixedImageType > FixedBlurType; + typedef itk::RecursiveGaussianImageFilter<FixedImageType, + FixedImageType> FixedBlurType; FixedBlurType::Pointer fBlur = FixedBlurType::New(); - fBlur->SetInput( fReader->GetOutput() ); - fBlur->SetSigma( atof(argv[5]) ); + fBlur->SetInput(fReader->GetOutput()); + fBlur->SetSigma(atof(argv[5])); - typedef itk::RecursiveGaussianImageFilter< MovingImageType, - MovingImageType > MovingBlurType; + typedef itk::RecursiveGaussianImageFilter<MovingImageType, + MovingImageType> MovingBlurType; MovingBlurType::Pointer mBlur = MovingBlurType::New(); - mBlur->SetInput( mReader->GetOutput() ); - mBlur->SetSigma(atof(argv[5]) ); + mBlur->SetInput(mReader->GetOutput()); + mBlur->SetSigma(atof(argv[5])); - typedef otb::NCCRegistrationFilter< FixedImageType, - MovingImageType, - DeformationFieldType > + typedef otb::NCCRegistrationFilter<FixedImageType, + MovingImageType, + DeformationFieldType> RegistrationFilterType; RegistrationFilterType::Pointer registrator = RegistrationFilterType::New(); - registrator->SetMovingImage( mBlur->GetOutput() ); - registrator->SetFixedImage( fBlur->GetOutput() ); + registrator->SetMovingImage(mBlur->GetOutput()); + registrator->SetFixedImage(fBlur->GetOutput()); typedef RegistrationFilterType::RadiusType RadiusType; @@ -85,17 +85,16 @@ int otbNCCRegistrationFilter(int argc, char* argv []) radius[0] = atoi(argv[4]); radius[1] = atoi(argv[4]); - registrator->SetNCCRadius( radius ); + registrator->SetNCCRadius(radius); - registrator->SetNumberOfIterations( atoi(argv[6]) ); + registrator->SetNumberOfIterations(atoi(argv[6])); typedef otb::StreamingImageFileWriter<DeformationFieldType> DFWriterType; DFWriterType::Pointer dfWriter = DFWriterType::New(); dfWriter->SetFileName(argv[3]); - dfWriter->SetInput( registrator->GetOutput() ); + dfWriter->SetInput(registrator->GetOutput()); dfWriter->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/DisparityMap/otbNCCRegistrationFilterNew.cxx b/Testing/Code/DisparityMap/otbNCCRegistrationFilterNew.cxx index e06c3947c0..4352e4eb52 100644 --- a/Testing/Code/DisparityMap/otbNCCRegistrationFilterNew.cxx +++ b/Testing/Code/DisparityMap/otbNCCRegistrationFilterNew.cxx @@ -22,21 +22,21 @@ int otbNCCRegistrationFilterNew(int argc, char* argv[]) { const unsigned int ImageDimension = 2; - typedef double PixelType; - typedef itk::Vector<double,ImageDimension> DeformationPixelType; + typedef double PixelType; + typedef itk::Vector<double, ImageDimension> DeformationPixelType; - typedef double CoordinateRepresentationType; + typedef double CoordinateRepresentationType; //Allocate Images - typedef otb::Image<PixelType,ImageDimension> MovingImageType; - typedef otb::Image<PixelType,ImageDimension> FixedImageType; + typedef otb::Image<PixelType, ImageDimension> MovingImageType; + typedef otb::Image<PixelType, ImageDimension> FixedImageType; typedef otb::Image<DeformationPixelType, - ImageDimension> DeformationFieldType; + ImageDimension> DeformationFieldType; //Create the filter - typedef otb::NCCRegistrationFilter< FixedImageType, - MovingImageType, - DeformationFieldType > + typedef otb::NCCRegistrationFilter<FixedImageType, + MovingImageType, + DeformationFieldType> RegistrationFilterType; // Instantiation diff --git a/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDeformationFieldGenerator.cxx b/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDeformationFieldGenerator.cxx index 30a68d6959..5fe8b75105 100644 --- a/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDeformationFieldGenerator.cxx +++ b/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDeformationFieldGenerator.cxx @@ -24,23 +24,23 @@ int otbNNearestPointsLinearInterpolateDeformationFieldGenerator(int argc, char * argv[]) { const unsigned int Dimension = 2; - const char * outfname = argv[1]; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef itk::Array<double> ParamType; - typedef itk::PointSet<ParamType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType,ImageType> FilterType; - typedef otb::ImageFileWriter<ImageType> WriterType; + const char * outfname = argv[1]; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef itk::Array<double> ParamType; + typedef itk::PointSet<ParamType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType, ImageType> FilterType; + typedef otb::ImageFileWriter<ImageType> WriterType; ImageType::SizeType size; size.Fill(100); double thresh = 0.9; // Preparing point set - PointSetType::Pointer ps = PointSetType::New(); - PointType p1,p2,p3,p4,p5; - ParamType pd1(3),pd2(3),pd3(3),pd4(3),pd5(3); + PointSetType::Pointer ps = PointSetType::New(); + PointType p1, p2, p3, p4, p5; + ParamType pd1(3), pd2(3), pd3(3), pd4(3), pd5(3); p1[0] = 10; p1[1] = 10; @@ -69,17 +69,16 @@ int otbNNearestPointsLinearInterpolateDeformationFieldGenerator(int argc, char * pd5[1] = 5; pd5[2] = 5; - ps->SetPoint(0,p1); - ps->SetPointData(0,pd1); - ps->SetPoint(1,p2); - ps->SetPointData(1,pd2); - ps->SetPoint(2,p3); - ps->SetPointData(2,pd3); - ps->SetPoint(3,p4); - ps->SetPointData(3,pd4); - ps->SetPoint(4,p5); - ps->SetPointData(4,pd5); - + ps->SetPoint(0, p1); + ps->SetPointData(0, pd1); + ps->SetPoint(1, p2); + ps->SetPointData(1, pd2); + ps->SetPoint(2, p3); + ps->SetPointData(2, pd3); + ps->SetPoint(3, p4); + ps->SetPointData(3, pd4); + ps->SetPoint(4, p5); + ps->SetPointData(4, pd5); // Instantiating object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDeformationFieldGeneratorNew.cxx index 004390ad22..7cbea8395f 100644 --- a/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDeformationFieldGeneratorNew.cxx +++ b/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDeformationFieldGeneratorNew.cxx @@ -23,15 +23,14 @@ int otbNNearestPointsLinearInterpolateDeformationFieldGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef ImageType::PointType PointType; - typedef itk::PointSet<PointType,Dimension> PointSetType; - typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType,ImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PointType PointType; + typedef itk::PointSet<PointType, Dimension> PointSetType; + typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.cxx b/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.cxx index 549d52df45..14fb7d474a 100644 --- a/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.cxx +++ b/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.cxx @@ -25,25 +25,25 @@ int otbNNearestTransformsLinearInterpolateDeformationFieldGenerator(int argc, char * argv[]) { const unsigned int Dimension = 2; - const char * outfname = argv[1]; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef itk::Array<double> ParamType; - typedef itk::PointSet<ParamType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType,ImageType> FilterType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::Euler2DTransform<double> TransformType; + const char * outfname = argv[1]; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef itk::Array<double> ParamType; + typedef itk::PointSet<ParamType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType, ImageType> FilterType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::Euler2DTransform<double> TransformType; ImageType::SizeType size; size.Fill(100); double thresh = 0.9; // Preparing point set - PointSetType::Pointer ps = PointSetType::New(); - PointType p1,p2,p3,p4,p5; - ParamType pd1(6),pd2(6),pd3(6),pd4(6),pd5(6); - itk::Point<double,2> center; + PointSetType::Pointer ps = PointSetType::New(); + PointType p1, p2, p3, p4, p5; + ParamType pd1(6), pd2(6), pd3(6), pd4(6), pd5(6); + itk::Point<double, 2> center; p1[0] = 10; p1[1] = 10; @@ -88,17 +88,16 @@ int otbNNearestTransformsLinearInterpolateDeformationFieldGenerator(int argc, ch pd5[4] = -5; pd5[5] = -0.001769; - - ps->SetPoint(0,p1); - ps->SetPointData(0,pd1); - ps->SetPoint(1,p2); - ps->SetPointData(1,pd2); - ps->SetPoint(2,p3); - ps->SetPointData(2,pd3); - ps->SetPoint(3,p4); - ps->SetPointData(3,pd4); - ps->SetPoint(4,p5); - ps->SetPointData(4,pd5); + ps->SetPoint(0, p1); + ps->SetPointData(0, pd1); + ps->SetPoint(1, p2); + ps->SetPointData(1, pd2); + ps->SetPoint(2, p3); + ps->SetPointData(2, pd3); + ps->SetPoint(3, p4); + ps->SetPointData(3, pd4); + ps->SetPoint(4, p5); + ps->SetPointData(4, pd5); TransformType::Pointer transform = TransformType::New(); transform->SetCenter(center); @@ -116,6 +115,5 @@ int otbNNearestTransformsLinearInterpolateDeformationFieldGenerator(int argc, ch writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDeformationFieldGeneratorNew.cxx index 9498d55245..a34fa974ec 100644 --- a/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDeformationFieldGeneratorNew.cxx +++ b/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDeformationFieldGeneratorNew.cxx @@ -23,15 +23,14 @@ int otbNNearestTransformsLinearInterpolateDeformationFieldGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef ImageType::PointType PointType; - typedef itk::PointSet<PointType,Dimension> PointSetType; - typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType,ImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PointType PointType; + typedef itk::PointSet<PointType, Dimension> PointSetType; + typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbNearestPointDeformationFieldGenerator.cxx b/Testing/Code/DisparityMap/otbNearestPointDeformationFieldGenerator.cxx index 3b1838e818..fcdd8a6678 100644 --- a/Testing/Code/DisparityMap/otbNearestPointDeformationFieldGenerator.cxx +++ b/Testing/Code/DisparityMap/otbNearestPointDeformationFieldGenerator.cxx @@ -24,23 +24,23 @@ int otbNearestPointDeformationFieldGenerator(int argc, char * argv[]) { const unsigned int Dimension = 2; - const char * outfname = argv[1]; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef itk::Array<double> ParamType; - typedef itk::PointSet<ParamType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef otb::NearestPointDeformationFieldGenerator<PointSetType,ImageType> FilterType; - typedef otb::ImageFileWriter<ImageType> WriterType; + const char * outfname = argv[1]; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef itk::Array<double> ParamType; + typedef itk::PointSet<ParamType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef otb::NearestPointDeformationFieldGenerator<PointSetType, ImageType> FilterType; + typedef otb::ImageFileWriter<ImageType> WriterType; ImageType::SizeType size; size.Fill(100); double thresh = 0.9; // Preparing point set - PointSetType::Pointer ps = PointSetType::New(); - PointType p1,p2,p3,p4,p5; - ParamType pd1(3),pd2(3),pd3(3),pd4(3),pd5(3); + PointSetType::Pointer ps = PointSetType::New(); + PointType p1, p2, p3, p4, p5; + ParamType pd1(3), pd2(3), pd3(3), pd4(3), pd5(3); p1[0] = 10; p1[1] = 10; @@ -69,17 +69,16 @@ int otbNearestPointDeformationFieldGenerator(int argc, char * argv[]) pd5[1] = 5; pd5[2] = 5; - ps->SetPoint(0,p1); - ps->SetPointData(0,pd1); - ps->SetPoint(1,p2); - ps->SetPointData(1,pd2); - ps->SetPoint(2,p3); - ps->SetPointData(2,pd3); - ps->SetPoint(3,p4); - ps->SetPointData(3,pd4); - ps->SetPoint(4,p5); - ps->SetPointData(4,pd5); - + ps->SetPoint(0, p1); + ps->SetPointData(0, pd1); + ps->SetPoint(1, p2); + ps->SetPointData(1, pd2); + ps->SetPoint(2, p3); + ps->SetPointData(2, pd3); + ps->SetPoint(3, p4); + ps->SetPointData(3, pd4); + ps->SetPoint(4, p5); + ps->SetPointData(4, pd5); // Instantiating object FilterType::Pointer filter = FilterType::New(); @@ -92,6 +91,5 @@ int otbNearestPointDeformationFieldGenerator(int argc, char * argv[]) writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbNearestPointDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbNearestPointDeformationFieldGeneratorNew.cxx index 525704e79c..9381bd5439 100644 --- a/Testing/Code/DisparityMap/otbNearestPointDeformationFieldGeneratorNew.cxx +++ b/Testing/Code/DisparityMap/otbNearestPointDeformationFieldGeneratorNew.cxx @@ -23,11 +23,11 @@ int otbNearestPointDeformationFieldGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef ImageType::PointType PointType; - typedef itk::PointSet<PointType,Dimension> PointSetType; - typedef otb::NearestPointDeformationFieldGenerator<PointSetType,ImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PointType PointType; + typedef itk::PointSet<PointType, Dimension> PointSetType; + typedef otb::NearestPointDeformationFieldGenerator<PointSetType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.cxx b/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.cxx index c44ac0c18b..18aa6917e6 100644 --- a/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.cxx +++ b/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.cxx @@ -25,25 +25,25 @@ int otbNearestTransformDeformationFieldGenerator(int argc, char * argv[]) { const unsigned int Dimension = 2; - const char * outfname = argv[1]; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef itk::Array<double> ParamType; - typedef itk::PointSet<ParamType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,ImageType> FilterType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::Euler2DTransform<double> TransformType; + const char * outfname = argv[1]; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef itk::Array<double> ParamType; + typedef itk::PointSet<ParamType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef otb::NearestTransformDeformationFieldGenerator<PointSetType, ImageType> FilterType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::Euler2DTransform<double> TransformType; ImageType::SizeType size; size.Fill(100); double thresh = 0.9; // Preparing point set - PointSetType::Pointer ps = PointSetType::New(); - PointType p1,p2,p3,p4,p5; - ParamType pd1(6),pd2(6),pd3(6),pd4(6),pd5(6); - itk::Point<double,2> center; + PointSetType::Pointer ps = PointSetType::New(); + PointType p1, p2, p3, p4, p5; + ParamType pd1(6), pd2(6), pd3(6), pd4(6), pd5(6); + itk::Point<double, 2> center; p1[0] = 10; p1[1] = 10; @@ -88,22 +88,20 @@ int otbNearestTransformDeformationFieldGenerator(int argc, char * argv[]) pd5[4] = -5; pd5[5] = -0.001769; - ps->SetPoint(0,p1); - ps->SetPointData(0,pd1); - ps->SetPoint(1,p2); - ps->SetPointData(1,pd2); - ps->SetPoint(2,p3); - ps->SetPointData(2,pd3); - ps->SetPoint(3,p4); - ps->SetPointData(3,pd4); - ps->SetPoint(4,p5); - ps->SetPointData(4,pd5); - + ps->SetPoint(0, p1); + ps->SetPointData(0, pd1); + ps->SetPoint(1, p2); + ps->SetPointData(1, pd2); + ps->SetPoint(2, p3); + ps->SetPointData(2, pd3); + ps->SetPoint(3, p4); + ps->SetPointData(3, pd4); + ps->SetPoint(4, p5); + ps->SetPointData(4, pd5); TransformType::Pointer transform = TransformType::New(); transform->SetCenter(center); - // Instantiating object FilterType::Pointer filter = FilterType::New(); filter->SetOutputSize(size); @@ -116,6 +114,5 @@ int otbNearestTransformDeformationFieldGenerator(int argc, char * argv[]) writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGeneratorNew.cxx index 3e3384a38b..f77592f996 100644 --- a/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGeneratorNew.cxx +++ b/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGeneratorNew.cxx @@ -23,15 +23,14 @@ int otbNearestTransformDeformationFieldGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef ImageType::PointType PointType; - typedef itk::PointSet<PointType,Dimension> PointSetType; - typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,ImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PointType PointType; + typedef itk::PointSet<PointType, Dimension> PointSetType; + typedef otb::NearestTransformDeformationFieldGenerator<PointSetType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbPointSetToDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbPointSetToDeformationFieldGeneratorNew.cxx index 987d47331a..6ec01f2711 100644 --- a/Testing/Code/DisparityMap/otbPointSetToDeformationFieldGeneratorNew.cxx +++ b/Testing/Code/DisparityMap/otbPointSetToDeformationFieldGeneratorNew.cxx @@ -23,15 +23,14 @@ int otbPointSetToDeformationFieldGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef ImageType::PointType PointType; - typedef itk::PointSet<PointType,Dimension> PointSetType; - typedef otb::PointSetToDeformationFieldGenerator<PointSetType,ImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PointType PointType; + typedef itk::PointSet<PointType, Dimension> PointSetType; + typedef otb::PointSetToDeformationFieldGenerator<PointSetType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx index 1ec453dd05..0b15b170eb 100644 --- a/Testing/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx +++ b/Testing/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx @@ -23,11 +23,11 @@ int otbPointSetWithTransformToDeformationFieldGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef ImageType::PointType PointType; - typedef itk::PointSet<PointType,Dimension> PointSetType; - typedef otb::PointSetWithTransformToDeformationFieldGenerator<PointSetType,ImageType> FilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PointType PointType; + typedef itk::PointSet<PointType, Dimension> PointSetType; + typedef otb::PointSetWithTransformToDeformationFieldGenerator<PointSetType, ImageType> FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/DisparityMap/otbStreamingWarpImageFilter.cxx b/Testing/Code/DisparityMap/otbStreamingWarpImageFilter.cxx index 88f3270f9f..44f4bbef4b 100644 --- a/Testing/Code/DisparityMap/otbStreamingWarpImageFilter.cxx +++ b/Testing/Code/DisparityMap/otbStreamingWarpImageFilter.cxx @@ -24,11 +24,11 @@ int otbStreamingWarpImageFilter(int argc, char* argv[]) { - if (argc!=5) - { - std::cout<<"usage: "<<argv[0]<<"infname deffname outfname radius"<<std::endl; + if (argc != 5) + { + std::cout << "usage: " << argv[0] << "infname deffname outfname radius" << std::endl; return EXIT_SUCCESS; - } + } // Input parameters const char * infname = argv[1]; @@ -37,25 +37,25 @@ int otbStreamingWarpImageFilter(int argc, char* argv[]) const double maxdef = atoi(argv[4]); // Images definition - const unsigned int Dimension=2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::Vector<PixelType,2> DeformationValueType; - typedef otb::Image<DeformationValueType,Dimension> DeformationFieldType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::Vector<PixelType, 2> DeformationValueType; + typedef otb::Image<DeformationValueType, Dimension> DeformationFieldType; // Warper - typedef otb::StreamingWarpImageFilter<ImageType,ImageType,DeformationFieldType> ImageWarperType; + typedef otb::StreamingWarpImageFilter<ImageType, ImageType, DeformationFieldType> ImageWarperType; // Reader/Writer - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileReader<DeformationFieldType> DeformationReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; // Objects creation DeformationReaderType::Pointer deformationReader = DeformationReaderType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - ImageWarperType::Pointer warper = ImageWarperType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + ImageWarperType::Pointer warper = ImageWarperType::New(); // Reading reader->SetFileName(infname); diff --git a/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx b/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx index d9d81be152..0909e26bdb 100644 --- a/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx +++ b/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx @@ -22,14 +22,14 @@ int otbStreamingWarpImageFilterNew(int argc, char* argv[]) { // Images definition - const unsigned int Dimension=2; - typedef double PixelType; - typedef itk::Vector<PixelType,2> DeformationValueType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::Image<DeformationValueType,2> DeformationFieldType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef itk::Vector<PixelType, 2> DeformationValueType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::Image<DeformationValueType, 2> DeformationFieldType; // Warper - typedef otb::StreamingWarpImageFilter<ImageType,ImageType,DeformationFieldType> ImageWarperType; + typedef otb::StreamingWarpImageFilter<ImageType, ImageType, DeformationFieldType> ImageWarperType; // Objects creation ImageWarperType::Pointer warper = ImageWarperType::New(); diff --git a/Testing/Code/DisparityMap/otbTranslationDeformationFieldEstimation.cxx b/Testing/Code/DisparityMap/otbTranslationDeformationFieldEstimation.cxx index e17f3aa7d0..b179bbb454 100644 --- a/Testing/Code/DisparityMap/otbTranslationDeformationFieldEstimation.cxx +++ b/Testing/Code/DisparityMap/otbTranslationDeformationFieldEstimation.cxx @@ -37,79 +37,95 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) { - if (argc!=11) - { - std::cout<<"usage: "<<argv[0]<<" fixedFileName movingFileName outputFileName explorationSize windowSize learningRate numberOfIterations metricThreshold nbPointToInterpolate pontsetStep"<<std::endl; + if (argc != 11) + { + std::cout << "usage: " << argv[0] << + " fixedFileName movingFileName outputFileName explorationSize windowSize learningRate numberOfIterations metricThreshold nbPointToInterpolate pontsetStep" + << std::endl; return EXIT_SUCCESS; - } + } // Input parameters - const char* fixedFileName = argv[1]; - const char* movingFileName = argv[2]; - const char* outputFileNamePrefix = argv[3]; + const char* fixedFileName = argv[1]; + const char* movingFileName = argv[2]; + const char* outputFileNamePrefix = argv[3]; const unsigned int exploSize = atoi(argv[4]); const unsigned int winSize = atoi(argv[5]); - const double learningRate = atof(argv[6]); + const double learningRate = atof(argv[6]); const unsigned int niterations = atoi(argv[7]); - const double metricThreshold = atof(argv[8]); + const double metricThreshold = atof(argv[8]); const unsigned int nbPointsToInterpolate = atoi(argv[9]); const unsigned int step = atoi(argv[10]); // 0. DEFINTIONS // Images definition - const unsigned int Dimension=2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef ImageType::IndexType IndexType; - typedef ImageType::SizeType SizeType; - typedef otb::VectorImage<double,Dimension> DeformationFieldType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef ImageType::IndexType IndexType; + typedef ImageType::SizeType SizeType; + typedef otb::VectorImage<double, Dimension> DeformationFieldType; // Transform definition - typedef itk::TranslationTransform<double,Dimension> TransformType; - typedef TransformType::ParametersType ParametersType; + typedef itk::TranslationTransform<double, Dimension> TransformType; + typedef TransformType::ParametersType ParametersType; // Pointset definition - typedef itk::PointSet<ParametersType,Dimension> PointSetType; - typedef PointSetType::PointType PointType; - typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; - typedef PointSetType::PointsContainer PointsContainerType; + typedef itk::PointSet<ParametersType, Dimension> PointSetType; + typedef PointSetType::PointType PointType; + typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; typedef PointSetType::PointDataContainer::Iterator PointDataIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; + typedef PointSetType::PointDataContainer PointDataContainerType; // Disparity map estimator definition - typedef otb::DisparityMapEstimationMethod<ImageType,ImageType,PointSetType> DMEstimationType; + typedef otb::DisparityMapEstimationMethod<ImageType, ImageType, PointSetType> DMEstimationType; // Metric definition - typedef itk::NormalizedCorrelationImageToImageMetric<ImageType,ImageType> MetricType; + typedef itk::NormalizedCorrelationImageToImageMetric<ImageType, ImageType> MetricType; // Interpolator definition - typedef itk::Function::HammingWindowFunction<3> WindowFunctionType; - typedef itk::ZeroFluxNeumannBoundaryCondition<ImageType> ConditionType; - typedef itk::WindowedSincInterpolateImageFunction<ImageType,3,WindowFunctionType,ConditionType ,double> InterpolatorType; + typedef itk::Function::HammingWindowFunction<3> + WindowFunctionType; + typedef itk::ZeroFluxNeumannBoundaryCondition<ImageType> + ConditionType; + typedef itk::WindowedSincInterpolateImageFunction<ImageType, 3, WindowFunctionType, ConditionType, + double> InterpolatorType; // Optimizer definition typedef itk::GradientDescentOptimizer OptimizerType; // IO definition - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; typedef otb::ImageFileWriter<DeformationFieldType> DeformationFieldWriterType; // Additional filters - typedef itk::RescaleIntensityImageFilter<ImageType,OutputImageType> RescalerType; + typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescalerType; // Deformation fields generator - typedef otb::NearestPointDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestPointGeneratorType; - typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestPointGeneratorType; - typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesGeneratorType; - typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestTransformGeneratorType; - typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestTransformGeneratorType; - typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesTransformGeneratorType; + typedef otb::NearestPointDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NearestPointGeneratorType; + typedef otb::NNearestPointsLinearInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NNearestPointGeneratorType; + typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> BSplinesGeneratorType; + typedef otb::NearestTransformDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NearestTransformGeneratorType; + typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType, + DeformationFieldType> + NNearestTransformGeneratorType; + typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType, + DeformationFieldType> + BSplinesTransformGeneratorType; // Warper - typedef itk::WarpImageFilter<ImageType,ImageType,DeformationFieldType> ImageWarperType; + typedef itk::WarpImageFilter<ImageType, ImageType, DeformationFieldType> ImageWarperType; //Input images reading ReaderType::Pointer fixedReader = ReaderType::New(); @@ -121,40 +137,40 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) movingReader->Update(); // 1. POINTSET CREATION - SizeType fixedSize = fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize(); - unsigned int NumberOfXNodes = (fixedSize[0]-2*exploSize-1)/step; - unsigned int NumberOfYNodes = (fixedSize[1]-2*exploSize-1)/step; - unsigned int NumberOfNodes = NumberOfXNodes*NumberOfYNodes; + SizeType fixedSize = fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize(); + unsigned int NumberOfXNodes = (fixedSize[0] - 2 * exploSize - 1) / step; + unsigned int NumberOfYNodes = (fixedSize[1] - 2 * exploSize - 1) / step; + unsigned int NumberOfNodes = NumberOfXNodes * NumberOfYNodes; - std::cout<<"PointSet size: "<<NumberOfNodes<<std::endl; + std::cout << "PointSet size: " << NumberOfNodes << std::endl; IndexType firstNodeIndex; firstNodeIndex[0] = exploSize; firstNodeIndex[1] = exploSize; - PointSetType::Pointer nodes = PointSetType::New(); - unsigned int nodeCounter = 0; + PointSetType::Pointer nodes = PointSetType::New(); + unsigned int nodeCounter = 0; std::cout << "Node coordinates : " << std::endl; - for (unsigned int x=0; x<NumberOfXNodes; x++) - for (unsigned int y=0; y<NumberOfYNodes; y++) - { + for (unsigned int x = 0; x < NumberOfXNodes; x++) + for (unsigned int y = 0; y < NumberOfYNodes; y++) + { PointType p; - p[0] = firstNodeIndex[0]+x*step; // x coordinate - p[1] = firstNodeIndex[1]+y*step; // y coordinate + p[0] = firstNodeIndex[0] + x * step; // x coordinate + p[1] = firstNodeIndex[1] + y * step; // y coordinate std::cout << "Id: " << nodeCounter << " -> " << p << std::endl; - nodes->SetPoint( nodeCounter++, p ); - } + nodes->SetPoint(nodeCounter++, p); + } // Fix to avoid recomputing the disparity for each deformation field generation method. nodes->SetBufferedRegion(0); // 2. DISPARITY MAP ESTIMATION DMEstimationType::Pointer dmestimator = DMEstimationType::New(); - TransformType::Pointer transform = TransformType::New(); - OptimizerType::Pointer optimizer = OptimizerType::New(); + TransformType::Pointer transform = TransformType::New(); + OptimizerType::Pointer optimizer = OptimizerType::New(); InterpolatorType::Pointer interpolator = InterpolatorType::New(); - MetricType::Pointer metric = MetricType::New(); + MetricType::Pointer metric = MetricType::New(); metric->SetSubtractMean(true); optimizer->MinimizeOn(); @@ -165,16 +181,16 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) dmestimator->SetMetric(metric); // For gradient descent - optimizer->SetLearningRate( learningRate ); - optimizer->SetNumberOfIterations( niterations ); - DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters() ); + optimizer->SetLearningRate(learningRate); + optimizer->SetNumberOfIterations(niterations); + DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters()); initialParameters[0] = 0.0; // Initial offset in mm along X initialParameters[1] = 0.0; // Initial offset in mm along Y //Initial parameter set up dmestimator->SetInitialTransformParameters(initialParameters); // inputs wiring - ImageType::SizeType win,explo; + ImageType::SizeType win, explo; win.Fill(winSize); explo.Fill(exploSize); @@ -186,11 +202,11 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) dmestimator->SetInitialTransformParameters(initialParameters); // 3. DEFORMATION FIELDS COMPUTATION - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); DeformationFieldWriterType::Pointer dfwriter = DeformationFieldWriterType::New(); - ImageWarperType::Pointer warper = ImageWarperType::New(); - RescalerType::Pointer rescaler = RescalerType::New(); - itk::OStringStream oss; + ImageWarperType::Pointer warper = ImageWarperType::New(); + RescalerType::Pointer rescaler = RescalerType::New(); + itk::OStringStream oss; //3.a Nearest point deformation field generator NearestPointGeneratorType::Pointer generator1 = NearestPointGeneratorType::New(); @@ -207,13 +223,13 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) rescaler->SetOutputMinimum(0); oss.str(""); - oss<<outputFileNamePrefix<<"_np_df.hdr"; + oss << outputFileNamePrefix << "_np_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator1->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_np_oi.tif"; + oss << outputFileNamePrefix << "_np_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -232,7 +248,6 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) generator2->SetMetricThreshold(metricThreshold); generator2->SetNumberOfPoints(nbPointsToInterpolate); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator2->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -240,13 +255,13 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) rescaler->SetOutputMinimum(0); oss.str(""); - oss<<outputFileNamePrefix<<"_nnp_df.hdr"; + oss << outputFileNamePrefix << "_nnp_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator2->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnp_oi.tif"; + oss << outputFileNamePrefix << "_nnp_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -264,7 +279,6 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) generator3->SetOutputSize(fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize()); generator3->SetMetricThreshold(metricThreshold); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator3->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -272,13 +286,13 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) rescaler->SetOutputMinimum(0); oss.str(""); - oss<<outputFileNamePrefix<<"_bs_df.hdr"; + oss << outputFileNamePrefix << "_bs_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator3->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bs_oi.tif"; + oss << outputFileNamePrefix << "_bs_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -304,13 +318,13 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) rescaler->SetOutputMinimum(0); oss.str(""); - oss<<outputFileNamePrefix<<"_nt_df.hdr"; + oss << outputFileNamePrefix << "_nt_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator4->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nt_oi.tif"; + oss << outputFileNamePrefix << "_nt_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); @@ -337,18 +351,17 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) rescaler->SetOutputMinimum(0); oss.str(""); - oss<<outputFileNamePrefix<<"_nnt_df.hdr"; + oss << outputFileNamePrefix << "_nnt_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator5->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_nnt_oi.tif"; + oss << outputFileNamePrefix << "_nnt_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); - //3.e Transforms deformation field spline interpolation generator writer = WriterType::New(); dfwriter = DeformationFieldWriterType::New(); @@ -365,7 +378,6 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) generator6->SetSplineOrder(4); generator6->SetNumberOfControlPoints(5); - warper->SetInput(movingReader->GetOutput()); warper->SetDeformationField(generator6->GetOutput()); rescaler->SetInput(warper->GetOutput()); @@ -373,13 +385,13 @@ int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) rescaler->SetOutputMinimum(0); oss.str(""); - oss<<outputFileNamePrefix<<"_bst_df.hdr"; + oss << outputFileNamePrefix << "_bst_df.hdr"; dfwriter->SetFileName(oss.str().c_str()); dfwriter->SetInput(generator6->GetOutput()); dfwriter->Update(); oss.str(""); - oss<<outputFileNamePrefix<<"_bst_oi.tif"; + oss << outputFileNamePrefix << "_bst_oi.tif"; writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); diff --git a/Testing/Code/FeatureExtraction/otbAddCarvingPathFilterNew.cxx b/Testing/Code/FeatureExtraction/otbAddCarvingPathFilterNew.cxx index db92851707..a94751162e 100644 --- a/Testing/Code/FeatureExtraction/otbAddCarvingPathFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbAddCarvingPathFilterNew.cxx @@ -26,18 +26,17 @@ int otbAddCarvingPathFilterNew(int argc, char* argv[]) { - typedef double PixelType; - const unsigned int Dimension = 2; + typedef double PixelType; + const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > InputImageType; - typedef otb::Image< PixelType, Dimension > OutputImageType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::AddCarvingPathFilter<InputImageType, PathType, - OutputImageType> AddCarvingPathFilterType; + OutputImageType> AddCarvingPathFilterType; AddCarvingPathFilterType::Pointer addCarvingPathFilter = AddCarvingPathFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbAlignImageToPath.cxx b/Testing/Code/FeatureExtraction/otbAlignImageToPath.cxx index db0035707a..7484bd825e 100644 --- a/Testing/Code/FeatureExtraction/otbAlignImageToPath.cxx +++ b/Testing/Code/FeatureExtraction/otbAlignImageToPath.cxx @@ -40,46 +40,44 @@ #include <stdio.h> -int otbAlignImageToPath( int argc, char * argv[] ) +int otbAlignImageToPath(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; + typedef double InputPixelType; + typedef double OutputPixelType; + typedef double RealPixelType; + const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef double OutputPixelType; - typedef double RealPixelType; - const unsigned int Dimension = 2; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<RealPixelType, Dimension> RealImageType; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< RealPixelType, Dimension > RealImageType; - - typedef itk::PolyLineParametricPath< Dimension > PathType; + typedef itk::PolyLineParametricPath<Dimension> PathType; typedef PathType::Pointer PathTypePointer; PathType::Pointer ltoto = PathType::New(); - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> ListAlignFilterType; - typedef itk::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> ListAlignFilterType; + typedef itk::ImageFileWriter<OutputImageType> WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); InputImageType::Pointer ImageIn = InputImageType::New(); - typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> TestType; + typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> TestType; TestType::Pointer testList = TestType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); //OTB-FA-00010-CS - testList->SetInput( reader->GetOutput() ); - - typedef ListAlignFilterType::OutputPathListType ListAlignFilterOutputPathListType; + testList->SetInput(reader->GetOutput()); + typedef ListAlignFilterType::OutputPathListType ListAlignFilterOutputPathListType; otbGenericMsgDebugMacro(<< "Before update"); testList->Update(); @@ -88,24 +86,24 @@ int otbAlignImageToPath( int argc, char * argv[] ) otbGenericMsgDebugMacro(<< "Writing :"); - FILE *file = fopen(outputFilename,"w"); + FILE *file = fopen(outputFilename, "w"); if (file == NULL) - { - fprintf(stderr,"Error, can't open file"); + { + fprintf(stderr, "Error, can't open file"); exit(-1); - } - typedef itk::ContinuousIndex< double,2> VertexType; - typedef itk::VectorContainer< unsigned,VertexType > VertexListType; - typedef VertexListType::ConstPointer VertexListTypePointer; + } + typedef itk::ContinuousIndex<double, 2> VertexType; + typedef itk::VectorContainer<unsigned, VertexType> VertexListType; + typedef VertexListType::ConstPointer VertexListTypePointer; VertexListTypePointer vertexList; - VertexType cindex; - double x1,y1,x2,y2; + VertexType cindex; + double x1, y1, x2, y2; int nbPath = sortiePath->Size(); - otbGenericMsgDebugMacro(<< "NbSegment: "<<nbPath); - fprintf(file,"Nb Segment: %d\n",nbPath); - for (int i =0; i<nbPath;i++) - { + otbGenericMsgDebugMacro(<< "NbSegment: " << nbPath); + fprintf(file, "Nb Segment: %d\n", nbPath); + for (int i = 0; i < nbPath; i++) + { vertexList = sortiePath->GetNthElement(i)->GetVertexList(); cindex = vertexList->GetElement(0); x1 = cindex[0]; @@ -113,14 +111,11 @@ int otbAlignImageToPath( int argc, char * argv[] ) cindex = vertexList->GetElement(1); x2 = cindex[0]; y2 = cindex[1]; - fprintf(file,"%8.3f %8.3f\n",x1,y1); - } + fprintf(file, "%8.3f %8.3f\n", x1, y1); + } fclose(file); // writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx b/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx index 95fe2b61b1..b319a49ef1 100644 --- a/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx +++ b/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx @@ -29,46 +29,41 @@ #include "otbImageFileWriter.h" #include "otbAssociativeSymmetricalSumImageFilter.h" - -int otbAssociativeSymmetricalSum( int argc, char* argv[] ) +int otbAssociativeSymmetricalSum(int argc, char* argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; const char * outputFilename = argv[3]; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; - - typedef itk::Image< InputPixelType, Dimension > InputImageType1; - typedef itk::Image< InputPixelType, Dimension > InputImageType2; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType1; + typedef itk::Image<InputPixelType, Dimension> InputImageType2; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType1 > ReaderType1; - typedef otb::ImageFileReader< InputImageType2 > ReaderType2; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType1> ReaderType1; + typedef otb::ImageFileReader<InputImageType2> ReaderType2; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::AssociativeSymmetricalSumImageFilter< InputImageType1, InputImageType2, OutputImageType > FilterType; + typedef otb::AssociativeSymmetricalSumImageFilter<InputImageType1, InputImageType2, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); ReaderType1::Pointer reader1 = ReaderType1::New(); ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); - filter->SetInput1( reader1->GetOutput() ); - filter->SetInput2( reader2->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx b/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx index 8afcd63eeb..2c13c2031b 100644 --- a/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx +++ b/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx @@ -24,26 +24,21 @@ #include "itkImage.h" #include <iostream> - #include "otbAssociativeSymmetricalSumImageFilter.h" - -int otbAssociativeSymmetricalSumNew( int argc, char* argv[] ) +int otbAssociativeSymmetricalSumNew(int argc, char* argv[]) { - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType1; - typedef itk::Image< InputPixelType, Dimension > InputImageType2; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType1; + typedef itk::Image<InputPixelType, Dimension> InputImageType2; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::AssociativeSymmetricalSumImageFilter< InputImageType1, InputImageType2, OutputImageType > FilterType; + typedef otb::AssociativeSymmetricalSumImageFilter<InputImageType1, InputImageType2, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetector.cxx b/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetector.cxx index e72ccc70d1..c7ad78b808 100644 --- a/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetector.cxx +++ b/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetector.cxx @@ -30,48 +30,47 @@ #include "otbImageFileWriter.h" #include "otbAssymmetricFusionOfLineDetectorImageFilter.h" -int otbAssymmetricFusionOfLineDetector( int argc, char * argv[] ) +int otbAssymmetricFusionOfLineDetector(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; // Width of the linear feature = 2*WidthLine+1 - unsigned int WidthLine((unsigned int)::atoi(argv[3])); + unsigned int WidthLine((unsigned int) ::atoi(argv[3])); // Length of the linear feature = 2*LengthLine+1 - unsigned int LengthLine((unsigned int)::atoi(argv[4])); + unsigned int LengthLine((unsigned int) ::atoi(argv[4])); - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageDirectionType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageDirectionType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType; + typedef itk::LinearInterpolateImageFunction<InputImageType, double> InterpolatorType; - typedef otb::AssymmetricFusionOfLineDetectorImageFilter< InputImageType, OutputImageType, OutputImageDirectionType, InterpolatorType > FilterType; + typedef otb::AssymmetricFusionOfLineDetectorImageFilter<InputImageType, OutputImageType, OutputImageDirectionType, + InterpolatorType> FilterType; FilterType::Pointer FilterAssSymSum = FilterType::New(); - FilterAssSymSum->SetWidthLine( WidthLine ); - FilterAssSymSum->SetLengthLine( LengthLine ); + FilterAssSymSum->SetWidthLine(WidthLine); + FilterAssSymSum->SetLengthLine(LengthLine); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - FilterAssSymSum->SetInput( reader->GetOutput() ); - writer->SetInput( FilterAssSymSum->GetOutput() ); + FilterAssSymSum->SetInput(reader->GetOutput()); + writer->SetInput(FilterAssSymSum->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetectorNew.cxx b/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetectorNew.cxx index 405f71589c..c1b77b37af 100644 --- a/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetectorNew.cxx +++ b/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetectorNew.cxx @@ -30,26 +30,24 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - #include "otbAssymmetricFusionOfLineDetectorImageFilter.h" -int otbAssymmetricFusionOfLineDetectorNew( int argc, char * argv[] ) +int otbAssymmetricFusionOfLineDetectorNew(int argc, char * argv[]) { - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageDirectionType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageDirectionType; - typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType; + typedef itk::LinearInterpolateImageFunction<InputImageType, double> InterpolatorType; - typedef otb::AssymmetricFusionOfLineDetectorImageFilter< InputImageType, OutputImageType, OutputImageDirectionType, InterpolatorType > FilterType; + typedef otb::AssymmetricFusionOfLineDetectorImageFilter<InputImageType, OutputImageType, OutputImageDirectionType, + InterpolatorType> FilterType; FilterType::Pointer FilterAssSymSum = FilterType::New(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx index 6a8f133a63..ee569d96b2 100644 --- a/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx @@ -28,8 +28,8 @@ int otbBreakAngularPathListFilter(int argc, char * argv[]) { const char * outfname = argv[1]; - typedef std::vector<double> PointsVectorType; - typedef std::vector< PointsVectorType > PointsMatrixType; + typedef std::vector<double> PointsVectorType; + typedef std::vector<PointsVectorType> PointsMatrixType; PointsMatrixType MatricePoints; PointsVectorType ListPoints; PointsVectorType ListMaxAngle; @@ -37,60 +37,57 @@ int otbBreakAngularPathListFilter(int argc, char * argv[]) int cpt = 2; ListMaxAngle.clear(); - while ( argv[cpt][0] != '|' ) - { + while (argv[cpt][0] != '|') + { ListMaxAngle.push_back(static_cast<double>(::atof(argv[cpt]))); cpt++; - } + } cpt++; ListPoints.clear(); - while ( argv[cpt] != NULL ) - { - if ( argv[cpt][0] == '|' ) + while (argv[cpt] != NULL) { - if ( (ListPoints.size()%2) != 0 ) + if (argv[cpt][0] == '|') { - itkGenericExceptionMacro(<<"Missing point in parameters !"); - } + if ((ListPoints.size() % 2) != 0) + { + itkGenericExceptionMacro(<< "Missing point in parameters !"); + } MatricePoints.push_back(ListPoints); ListPoints.clear(); - } + } else - { + { ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } + } cpt++; - } + } MatricePoints.push_back(ListPoints); - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::BreakAngularPathListFilter<PathType> BreakAngularPathListFilterType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::BreakAngularPathListFilter<PathType> BreakAngularPathListFilterType; typedef BreakAngularPathListFilterType::PathListType PathListType; PathType::ContinuousIndexType cindex; - PathListType::Pointer InputPathList = PathListType::New(); //Generate PathList - for (PointsMatrixType::iterator listpos=MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { + for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) + { PathType::Pointer path = PathType::New(); //Generate PathList - std::cout << "List "<<std::endl; - for (PointsVectorType::iterator it=(*listpos).begin(); it != (*listpos).end(); ++it) - { + std::cout << "List " << std::endl; + for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) + { cindex[0] = *it; ++it; cindex[1] = *it; - std::cout << "Point Index :"<<cindex[0]<<";"<<cindex[1]<<std::endl; + std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; path->AddVertex(cindex); - } + } InputPathList->PushBack(path); - } - + } // Instantiating object BreakAngularPathListFilterType::Pointer breakAngularFilter = BreakAngularPathListFilterType::New(); @@ -99,68 +96,65 @@ int otbBreakAngularPathListFilter(int argc, char * argv[]) std::ofstream file; file.open(outfname); - for (PointsVectorType::iterator itAngle=ListMaxAngle.begin(); itAngle != ListMaxAngle.end(); ++itAngle) - { - + for (PointsVectorType::iterator itAngle = ListMaxAngle.begin(); itAngle != ListMaxAngle.end(); ++itAngle) + { - breakAngularFilter->SetMaxAngle((*itAngle)* otb::CONST_PI/180.); + breakAngularFilter->SetMaxAngle((*itAngle) * otb::CONST_PI / 180.); breakAngularFilter->Update(); - PathListType::Pointer OutputPathList = breakAngularFilter->GetOutput(); - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; + typedef PathListType::ConstIterator PathListIteratorType; + typedef PathType::VertexListType VertexListType; typedef VertexListType::ConstIterator VertexIteratorType; - unsigned int counter = 1; + unsigned int counter = 1; PathListIteratorType pathListIt = InputPathList->Begin(); - file<<"--------------------------------------------------------------------------"<<std::endl; - file<<"MAX ANGULAR :"<<breakAngularFilter->GetMaxAngle()<< "("<<(*itAngle)<<" deg.)"<<std::endl; - file<<"INPUT list of Path "<<": "<<std::endl; - while (pathListIt!=InputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "--------------------------------------------------------------------------" << std::endl; + file << "MAX ANGULAR :" << breakAngularFilter->GetMaxAngle() << "(" << (*itAngle) << " deg.)" << std::endl; + file << "INPUT list of Path " << ": " << std::endl; + while (pathListIt != InputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } counter = 1; pathListIt = OutputPathList->Begin(); - file<<"OUTPUT list of Path "<<": "<<std::endl; - while (pathListIt!=OutputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "OUTPUT list of Path " << ": " << std::endl; + while (pathListIt != OutputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } - } //Enf for angle + } //Enf for angle file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilterNew.cxx index 76e8d19e37..c1322986ad 100644 --- a/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilterNew.cxx @@ -23,12 +23,11 @@ int otbBreakAngularPathListFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::BreakAngularPathListFilter<PathType> BreakAngularPathListFilterType; // Instantiating object BreakAngularPathListFilterType::Pointer object = BreakAngularPathListFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbCloudDetectionFilter.cxx b/Testing/Code/FeatureExtraction/otbCloudDetectionFilter.cxx index 816e82f159..50bef72a0e 100644 --- a/Testing/Code/FeatureExtraction/otbCloudDetectionFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbCloudDetectionFilter.cxx @@ -24,22 +24,21 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbCloudDetectionFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef VectorImageType::PixelType VectorPixelType; - typedef otb::Functor::CloudDetectionFunctor<VectorPixelType,PixelType > FunctorType; - typedef otb::CloudDetectionFilter<VectorImageType,ImageType,FunctorType > CloudDetectionFilterType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef VectorImageType::PixelType VectorPixelType; + typedef otb::Functor::CloudDetectionFunctor<VectorPixelType, PixelType> FunctorType; + typedef otb::CloudDetectionFilter<VectorImageType, ImageType, FunctorType> CloudDetectionFilterType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; //Parameters - const char * inputFileName(argv[1]); - const char * outputFileName(argv[2]); + const char * inputFileName(argv[1]); + const char * outputFileName(argv[2]); VectorPixelType referencePixel; referencePixel.SetSize(4); referencePixel.Fill(0.); @@ -54,9 +53,9 @@ int otbCloudDetectionFilter(int argc, char * argv[]) const double maxThreshold = (atof(argv[9])); // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); CloudDetectionFilterType::Pointer cloudDetection = CloudDetectionFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); //Initialization parameters reader->SetFileName(inputFileName); @@ -67,7 +66,6 @@ int otbCloudDetectionFilter(int argc, char * argv[]) cloudDetection->SetMaxThreshold(maxThreshold); cloudDetection->SetVariance(variance); - writer->SetFileName(outputFileName); writer->SetInput(cloudDetection->GetOutput()); writer->Update(); diff --git a/Testing/Code/FeatureExtraction/otbCloudDetectionFilterNew.cxx b/Testing/Code/FeatureExtraction/otbCloudDetectionFilterNew.cxx index ad7bd471f3..33770cc803 100644 --- a/Testing/Code/FeatureExtraction/otbCloudDetectionFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbCloudDetectionFilterNew.cxx @@ -23,14 +23,12 @@ int otbCloudDetectionFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::CloudDetectionFilter<VectorImageType,ImageType > CloudDetectionFilterType; - + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::CloudDetectionFilter<VectorImageType, ImageType> CloudDetectionFilterType; // Instantiating object CloudDetectionFilterType::Pointer cloudDetection = CloudDetectionFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbCloudEstimatorDefaultFilter.cxx b/Testing/Code/FeatureExtraction/otbCloudEstimatorDefaultFilter.cxx index f7b61afb2b..fad69d5889 100644 --- a/Testing/Code/FeatureExtraction/otbCloudEstimatorDefaultFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbCloudEstimatorDefaultFilter.cxx @@ -24,21 +24,20 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbCloudEstimatorDefaultFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef VectorImageType::PixelType VectorPixelType; - typedef otb::CloudEstimatorFilter<VectorImageType,ImageType > CloudEstimatorFilterType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef VectorImageType::PixelType VectorPixelType; + typedef otb::CloudEstimatorFilter<VectorImageType, ImageType> CloudEstimatorFilterType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; //Parameters - const char * inputFileName(argv[1]); - const char * outputFileName(argv[2]); + const char * inputFileName(argv[1]); + const char * outputFileName(argv[2]); VectorPixelType referencePixel; referencePixel.SetSize(4); referencePixel.Fill(0.); @@ -48,13 +47,12 @@ int otbCloudEstimatorDefaultFilter(int argc, char * argv[]) referencePixel[2] = (atof(argv[5])); referencePixel[3] = (atof(argv[6])); - // Instantiating object ReaderType::Pointer reader = ReaderType::New(); // Using SpectralAngle Filter, the default functor CloudEstimatorFilterType::Pointer cloudEstimator = CloudEstimatorFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); //Initialization parameters reader->SetFileName(inputFileName); @@ -66,6 +64,5 @@ int otbCloudEstimatorDefaultFilter(int argc, char * argv[]) writer->SetInput(cloudEstimator->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbCloudEstimatorFilter.cxx b/Testing/Code/FeatureExtraction/otbCloudEstimatorFilter.cxx index f7f952efd0..4c9be0aade 100644 --- a/Testing/Code/FeatureExtraction/otbCloudEstimatorFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbCloudEstimatorFilter.cxx @@ -24,22 +24,21 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbCloudEstimatorFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef VectorImageType::PixelType VectorPixelType; - typedef otb::Functor::CloudEstimatorFunctor<VectorPixelType,PixelType > FunctorType; - typedef otb::CloudEstimatorFilter<VectorImageType,ImageType,FunctorType > CloudEstimatorFilterType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef VectorImageType::PixelType VectorPixelType; + typedef otb::Functor::CloudEstimatorFunctor<VectorPixelType, PixelType> FunctorType; + typedef otb::CloudEstimatorFilter<VectorImageType, ImageType, FunctorType> CloudEstimatorFilterType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; //Parameters - const char * inputFileName(argv[1]); - const char * outputFileName(argv[2]); + const char * inputFileName(argv[1]); + const char * outputFileName(argv[2]); VectorPixelType referencePixel; referencePixel.SetSize(4); referencePixel.Fill(0.); @@ -52,9 +51,9 @@ int otbCloudEstimatorFilter(int argc, char * argv[]) const double variance = (atof(argv[7])); // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); CloudEstimatorFilterType::Pointer cloudEstimator = CloudEstimatorFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); //Initialization parameters reader->SetFileName(inputFileName); @@ -63,7 +62,6 @@ int otbCloudEstimatorFilter(int argc, char * argv[]) cloudEstimator->SetReferencePixel(referencePixel); cloudEstimator->SetVariance(variance); - writer->SetFileName(outputFileName); writer->SetInput(cloudEstimator->GetOutput()); writer->Update(); diff --git a/Testing/Code/FeatureExtraction/otbCloudEstimatorFilterNew.cxx b/Testing/Code/FeatureExtraction/otbCloudEstimatorFilterNew.cxx index 0481e21271..51003619d0 100644 --- a/Testing/Code/FeatureExtraction/otbCloudEstimatorFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbCloudEstimatorFilterNew.cxx @@ -23,14 +23,12 @@ int otbCloudEstimatorFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::CloudEstimatorFilter<VectorImageType,ImageType > CloudEstimatorFilterType; - + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::CloudEstimatorFilter<VectorImageType, ImageType> CloudEstimatorFilterType; // Instantiating object CloudEstimatorFilterType::Pointer cloudEstimator = CloudEstimatorFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx b/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx index 5a5d5dbdb0..f98d61a368 100644 --- a/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx +++ b/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx @@ -25,56 +25,54 @@ #include "itkExceptionObject.h" #include "otbMath.h" -int otbCompacityPathCircle( int argc, char * argv[] ) +int otbCompacityPathCircle(int argc, char * argv[]) { - unsigned int NbOfPoints((unsigned int)::atoi(argv[1])); + unsigned int NbOfPoints((unsigned int) ::atoi(argv[1])); - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::CompacityPathFunction<PathType> FunctionType; - typedef FunctionType::RealType RealType; + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::CompacityPathFunction<PathType> FunctionType; + typedef FunctionType::RealType RealType; PathType::ContinuousIndexType cindex; - PathType::Pointer pathElt = PathType::New(); + PathType::Pointer pathElt = PathType::New(); - if (NbOfPoints<2) - { + if (NbOfPoints < 2) + { std::cout << "NbOfPoints must be greater than 2 !" << std::endl; return EXIT_FAILURE; - } + } - RealType deltaTheta; - RealType Rho = 100.0; + RealType deltaTheta; + RealType Rho = 100.0; - deltaTheta = 2.* otb::CONST_PI / static_cast<RealType>(NbOfPoints); + deltaTheta = 2. * otb::CONST_PI / static_cast<RealType>(NbOfPoints); pathElt->Initialize(); for (unsigned int noTheta = 0; noTheta < NbOfPoints; noTheta++) - { + { RealType Theta = deltaTheta * static_cast<RealType>(noTheta); - cindex[0]= (Rho * vcl_cos(Theta) ); - cindex[1]= (Rho * vcl_sin(Theta) ); + cindex[0] = (Rho * vcl_cos(Theta)); + cindex[1] = (Rho * vcl_sin(Theta)); pathElt->AddVertex(cindex); - } + } - FunctionType::Pointer function =FunctionType::New(); - function->SetInputPath( pathElt ); + FunctionType::Pointer function = FunctionType::New(); + function->SetInputPath(pathElt); RealType Result = function->Evaluate(); - std::cout << "Compacity result: " << Result <<std::endl; + std::cout << "Compacity result: " << Result << std::endl; RealType Error; - Error = vcl_abs(Result - static_cast<RealType>(1.0) ); + Error = vcl_abs(Result - static_cast<RealType>(1.0)); - if ( Error > 1.E-5) - { + if (Error > 1.E-5) + { std::cout << "Error in estimation !" << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbCompacityPathNew.cxx b/Testing/Code/FeatureExtraction/otbCompacityPathNew.cxx index 1bad6bdf75..e50ea89fec 100644 --- a/Testing/Code/FeatureExtraction/otbCompacityPathNew.cxx +++ b/Testing/Code/FeatureExtraction/otbCompacityPathNew.cxx @@ -26,15 +26,13 @@ #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" -int otbCompacityPathNew( int argc, char * argv[] ) +int otbCompacityPathNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::CompacityPathFunction<PathType> FunctionType; - - FunctionType::Pointer function =FunctionType::New(); + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::CompacityPathFunction<PathType> FunctionType; + FunctionType::Pointer function = FunctionType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx b/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx index 218992c0f4..e3a67f4325 100644 --- a/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx +++ b/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx @@ -25,63 +25,60 @@ #include "itkExceptionObject.h" #include "otbMath.h" -int otbCompacityPathRectangle( int argc, char * argv[] ) +int otbCompacityPathRectangle(int argc, char * argv[]) { - double A ((double)::atof(argv[1])); - double B ((double)::atof(argv[2])); + double A ((double) ::atof(argv[1])); + double B ((double) ::atof(argv[2])); - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::CompacityPathFunction<PathType> FunctionType; - typedef FunctionType::RealType RealType; + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::CompacityPathFunction<PathType> FunctionType; + typedef FunctionType::RealType RealType; PathType::ContinuousIndexType cindex; - PathType::Pointer pathElt = PathType::New(); + PathType::Pointer pathElt = PathType::New(); - if (A<0) - { + if (A < 0) + { std::cout << "retangle must be greater than 0.0 !" << std::endl; return EXIT_FAILURE; - } + } - if (B<0) - { + if (B < 0) + { std::cout << "rectangle must be greater than 0.0 !" << std::endl; return EXIT_FAILURE; - } + } pathElt->Initialize(); - cindex[0]= 100; - cindex[1]= 100; + cindex[0] = 100; + cindex[1] = 100; pathElt->AddVertex(cindex); - cindex[0]= 100+A; - cindex[1]= 100; + cindex[0] = 100 + A; + cindex[1] = 100; pathElt->AddVertex(cindex); - cindex[0]= 100+A; - cindex[1]= 100+B; + cindex[0] = 100 + A; + cindex[1] = 100 + B; pathElt->AddVertex(cindex); - cindex[0]= 100; - cindex[1]= 100+B; + cindex[0] = 100; + cindex[1] = 100 + B; pathElt->AddVertex(cindex); - - FunctionType::Pointer function =FunctionType::New(); - function->SetInputPath( pathElt ); + FunctionType::Pointer function = FunctionType::New(); + function->SetInputPath(pathElt); RealType Result = function->Evaluate(); - std::cout << "Compacity result: " << Result <<std::endl; + std::cout << "Compacity result: " << Result << std::endl; RealType Error; - Error = vcl_abs(Result - static_cast<RealType>(otb::CONST_PI * A*B / (A+B) / (A+B)) ); + Error = vcl_abs(Result - static_cast<RealType>(otb::CONST_PI * A * B / (A + B) / (A + B))); - if ( Error > 1.E-9) - { + if (Error > 1.E-9) + { std::cout << "Error in estimation !" << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx b/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx index 46e0678bae..00be199c17 100644 --- a/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx +++ b/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx @@ -25,57 +25,53 @@ #include "itkExceptionObject.h" #include "otbMath.h" -int otbCompacityPathSquare( int argc, char * argv[] ) +int otbCompacityPathSquare(int argc, char * argv[]) { - double A ((double)::atof(argv[1])); + double A ((double) ::atof(argv[1])); - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::CompacityPathFunction<PathType> FunctionType; - typedef FunctionType::RealType RealType; + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::CompacityPathFunction<PathType> FunctionType; + typedef FunctionType::RealType RealType; PathType::ContinuousIndexType cindex; - PathType::Pointer pathElt = PathType::New(); + PathType::Pointer pathElt = PathType::New(); - if (A<0) - { + if (A < 0) + { std::cout << "square must be greater than 0.0 !" << std::endl; return EXIT_FAILURE; - } - + } pathElt->Initialize(); - cindex[0]= 100; - cindex[1]= 100; + cindex[0] = 100; + cindex[1] = 100; pathElt->AddVertex(cindex); - cindex[0]= 100+A; - cindex[1]= 100; + cindex[0] = 100 + A; + cindex[1] = 100; pathElt->AddVertex(cindex); - cindex[0]= 100+A; - cindex[1]= 100+A; + cindex[0] = 100 + A; + cindex[1] = 100 + A; pathElt->AddVertex(cindex); - cindex[0]= 100; - cindex[1]= 100+A; + cindex[0] = 100; + cindex[1] = 100 + A; pathElt->AddVertex(cindex); - - FunctionType::Pointer function =FunctionType::New(); - function->SetInputPath( pathElt ); + FunctionType::Pointer function = FunctionType::New(); + function->SetInputPath(pathElt); RealType Result = function->Evaluate(); - std::cout << "Compacity result: " << Result <<std::endl; + std::cout << "Compacity result: " << Result << std::endl; RealType Error; - Error = vcl_abs(Result - static_cast<RealType>(otb::CONST_PI_4) ); + Error = vcl_abs(Result - static_cast<RealType>(otb::CONST_PI_4)); - if ( Error > 1.E-9) - { + if (Error > 1.E-9) + { std::cout << "Error in Theta estimation :" << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbComplexMomentImage.cxx b/Testing/Code/FeatureExtraction/otbComplexMomentImage.cxx index 35bcbac2e4..2e37798187 100644 --- a/Testing/Code/FeatureExtraction/otbComplexMomentImage.cxx +++ b/Testing/Code/FeatureExtraction/otbComplexMomentImage.cxx @@ -29,53 +29,51 @@ #include "otbImageFileReader.h" #include "otbComplexMomentImageFunction.h" -int otbComplexMomentImage( int argc, char * argv[] ) +int otbComplexMomentImage(int argc, char * argv[]) { const char * inputFilename = argv[1]; - unsigned int p((unsigned int)::atoi(argv[2])); - unsigned int q((unsigned int)::atoi(argv[3])); + unsigned int p((unsigned int) ::atoi(argv[2])); + unsigned int q((unsigned int) ::atoi(argv[3])); const char * outputFilename = argv[4]; - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - - typedef std::complex<float> ComplexType; - typedef otb::ComplexMomentImageFunction<InputImageType,ComplexType> CMType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef std::complex<float> ComplexType; + typedef otb::ComplexMomentImageFunction<InputImageType, ComplexType> CMType; ReaderType::Pointer reader = ReaderType::New(); - CMType::Pointer function =CMType::New(); + CMType::Pointer function = CMType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->Update(); - function->SetInputImage( reader->GetOutput() ); + function->SetInputImage(reader->GetOutput()); function->SetQ(q); function->SetP(p); InputImageType::IndexType index; - index[0]=10; - index[1]=10; + index[0] = 10; + index[1] = 10; ComplexType Result; std::ofstream outputStream(outputFilename); - Result = function->EvaluateAtIndex( index ); + Result = function->EvaluateAtIndex(index); outputStream << std::setprecision(10) << "function->EvaluateAtIndex( index ): " << Result << std::endl; outputStream << " With NeighborhoodRadius(3):" << std::endl; function->SetNeighborhoodRadius(3); - Result = function->EvaluateAtIndex( index ); + Result = function->EvaluateAtIndex(index); outputStream << "function->EvaluateAtIndex( index ): " << Result << std::endl; outputStream.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbComplexMomentPath.cxx b/Testing/Code/FeatureExtraction/otbComplexMomentPath.cxx index 23f99883eb..14c1ba9ccd 100644 --- a/Testing/Code/FeatureExtraction/otbComplexMomentPath.cxx +++ b/Testing/Code/FeatureExtraction/otbComplexMomentPath.cxx @@ -28,38 +28,38 @@ #include "itkExceptionObject.h" #include "itkPolyLineParametricPath.h" -int otbComplexMomentPath( int argc, char * argv[] ) +int otbComplexMomentPath(int argc, char * argv[]) { - unsigned int p((unsigned int)::atoi(argv[1])); - unsigned int q((unsigned int)::atoi(argv[2])); + unsigned int p((unsigned int) ::atoi(argv[1])); + unsigned int q((unsigned int) ::atoi(argv[2])); const char * outputFilename = argv[3]; - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::ComplexMomentPathFunction< PathType > CMType; - typedef CMType::ComplexType ComplexType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::ComplexMomentPathFunction<PathType> CMType; + typedef CMType::ComplexType ComplexType; // Dessiner un carr�: PathType::ContinuousIndexType cindex; - PathType::Pointer pathElt = PathType::New(); + PathType::Pointer pathElt = PathType::New(); pathElt->Initialize(); - cindex[0]=30; - cindex[1]=30; + cindex[0] = 30; + cindex[1] = 30; pathElt->AddVertex(cindex); - cindex[0]= 30; - cindex[1]=130; + cindex[0] = 30; + cindex[1] = 130; pathElt->AddVertex(cindex); - cindex[0]=130; - cindex[1]=130; + cindex[0] = 130; + cindex[1] = 130; pathElt->AddVertex(cindex); - cindex[0]=130; - cindex[1]= 30; + cindex[0] = 130; + cindex[1] = 30; pathElt->AddVertex(cindex); - CMType::Pointer function =CMType::New(); + CMType::Pointer function = CMType::New(); function->SetQ(q); function->SetP(p); @@ -68,10 +68,9 @@ int otbComplexMomentPath( int argc, char * argv[] ) std::ofstream outputStream(outputFilename); - Result = function->Evaluate( *pathElt); - outputStream << std::setprecision(10) << "function->Evaluate(Path)"<< Result << std::endl; + Result = function->Evaluate(*pathElt); + outputStream << std::setprecision(10) << "function->Evaluate(Path)" << Result << std::endl; outputStream.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbComplexMomentPathFloat.cxx b/Testing/Code/FeatureExtraction/otbComplexMomentPathFloat.cxx index 85b063f1e3..a5e67ad5f5 100644 --- a/Testing/Code/FeatureExtraction/otbComplexMomentPathFloat.cxx +++ b/Testing/Code/FeatureExtraction/otbComplexMomentPathFloat.cxx @@ -28,39 +28,38 @@ #include "itkExceptionObject.h" #include "itkPolyLineParametricPath.h" -int otbComplexMomentPathFloat( int argc, char * argv[] ) +int otbComplexMomentPathFloat(int argc, char * argv[]) { - unsigned int p((unsigned int)::atoi(argv[1])); - unsigned int q((unsigned int)::atoi(argv[2])); + unsigned int p((unsigned int) ::atoi(argv[1])); + unsigned int q((unsigned int) ::atoi(argv[2])); const char * outputFilename = argv[3]; - const unsigned int Dimension = 2; - - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef std::complex<float> ComplexType; - typedef otb::ComplexMomentPathFunction< PathType,ComplexType > CMType; + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef std::complex<float> ComplexType; + typedef otb::ComplexMomentPathFunction<PathType, ComplexType> CMType; // Dessiner un carr�: PathType::ContinuousIndexType cindex; - PathType::Pointer pathElt = PathType::New(); + PathType::Pointer pathElt = PathType::New(); pathElt->Initialize(); - cindex[0]=30; - cindex[1]=30; + cindex[0] = 30; + cindex[1] = 30; pathElt->AddVertex(cindex); - cindex[0]= 30; - cindex[1]=130; + cindex[0] = 30; + cindex[1] = 130; pathElt->AddVertex(cindex); - cindex[0]=130; - cindex[1]=130; + cindex[0] = 130; + cindex[1] = 130; pathElt->AddVertex(cindex); - cindex[0]=130; - cindex[1]= 30; + cindex[0] = 130; + cindex[1] = 30; pathElt->AddVertex(cindex); - CMType::Pointer function =CMType::New(); + CMType::Pointer function = CMType::New(); function->SetQ(q); function->SetP(p); @@ -68,11 +67,10 @@ int otbComplexMomentPathFloat( int argc, char * argv[] ) ComplexType Result; std::ofstream outputStream(outputFilename); - Result = function->Evaluate( *pathElt); - outputStream << std::setprecision(10) << "function->Evaluate(Path)"<< Result << std::endl; + Result = function->Evaluate(*pathElt); + outputStream << std::setprecision(10) << "function->Evaluate(Path)" << Result << std::endl; outputStream.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbComplexMomentPathNew.cxx b/Testing/Code/FeatureExtraction/otbComplexMomentPathNew.cxx index f6ce1f9e46..9eb2b51459 100644 --- a/Testing/Code/FeatureExtraction/otbComplexMomentPathNew.cxx +++ b/Testing/Code/FeatureExtraction/otbComplexMomentPathNew.cxx @@ -24,16 +24,14 @@ #include "otbComplexMomentPathFunction.h" #include "itkPolyLineParametricPath.h" -int otbComplexMomentPathNew( int argc, char * argv[] ) +int otbComplexMomentPathNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::ComplexMomentPathFunction<PathType> CMType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::ComplexMomentPathFunction<PathType> CMType; CMType::Pointer function = CMType::New(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbDrawPath.cxx b/Testing/Code/FeatureExtraction/otbDrawPath.cxx index 0f21448adc..c436d2958b 100644 --- a/Testing/Code/FeatureExtraction/otbDrawPath.cxx +++ b/Testing/Code/FeatureExtraction/otbDrawPath.cxx @@ -29,80 +29,74 @@ #include "otbDrawPathFilter.h" #include "otbImageFileWriter.h" - -int otbDrawPathDessinCarre( int argc, char * argv[] ) +int otbDrawPathDessinCarre(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; - - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef InputImageType::PointType InputImagePointType; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + typedef InputImageType::PointType InputImagePointType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef itk::ImageFileWriter< OutputImageType > WriterType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef itk::ImageFileWriter<OutputImageType> WriterType; - typedef otb::DrawPathFilter<InputImageType,PathType,OutputImageType> DrawPathFilterType; + typedef otb::DrawPathFilter<InputImageType, PathType, OutputImageType> DrawPathFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); PathType::Pointer VertexList = PathType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); InputImageType::ConstPointer image = reader->GetOutput(); - InputImagePointType pos; + InputImagePointType pos; PathType::ContinuousIndexType cindex; VertexList->Initialize(); /*1er Segment*/ - pos[0]=30; - pos[1]=30; - image->TransformPhysicalPointToContinuousIndex(pos,cindex); + pos[0] = 30; + pos[1] = 30; + image->TransformPhysicalPointToContinuousIndex(pos, cindex); VertexList->AddVertex(cindex); - pos[0]= 30; - pos[1]=130; - image->TransformPhysicalPointToContinuousIndex(pos,cindex); + pos[0] = 30; + pos[1] = 130; + image->TransformPhysicalPointToContinuousIndex(pos, cindex); VertexList->AddVertex(cindex); /*2eme Segment*/ - pos[0]=90; - pos[1]=130; - image->TransformPhysicalPointToContinuousIndex(pos,cindex); + pos[0] = 90; + pos[1] = 130; + image->TransformPhysicalPointToContinuousIndex(pos, cindex); VertexList->AddVertex(cindex); - /*3eme Segment*/ - pos[0]=90; - pos[1]= 30; - image->TransformPhysicalPointToContinuousIndex(pos,cindex); + pos[0] = 90; + pos[1] = 30; + image->TransformPhysicalPointToContinuousIndex(pos, cindex); VertexList->AddVertex(cindex); /*4eme Segment*/ - pos[0]=30; - pos[1]=30; - image->TransformPhysicalPointToContinuousIndex(pos,cindex); + pos[0] = 30; + pos[1] = 30; + image->TransformPhysicalPointToContinuousIndex(pos, cindex); VertexList->AddVertex(cindex); - DrawPathFilterType::Pointer DrawPath = DrawPathFilterType::New(); - DrawPath->SetImageInput( reader->GetOutput() ); - DrawPath->SetInputPath( VertexList ); + DrawPath->SetImageInput(reader->GetOutput()); + DrawPath->SetInputPath(VertexList); writer->SetInput(DrawPath->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx b/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx index 37543cd235..ed80eaa26b 100644 --- a/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx +++ b/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx @@ -31,55 +31,53 @@ #include "otbDrawPathListFilter.h" #include "otbImageFileWriter.h" - -int otbDrawPathAlign( int argc, char * argv[] ) +int otbDrawPathAlign(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; - - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef PathType::Pointer PathPointerType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef PathType::Pointer PathPointerType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef itk::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef itk::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> PathListType; - typedef PathListType::OutputPathListType OutputPathListType; + typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> PathListType; + typedef PathListType::OutputPathListType OutputPathListType; - typedef otb::DrawPathListFilter<InputImageType,PathType,OutputImageType> DrawPathFilterType; + typedef otb::DrawPathListFilter<InputImageType, PathType, OutputImageType> DrawPathFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); DrawPathFilterType::Pointer DrawPath = DrawPathFilterType::New(); - PathType::Pointer VertexList = PathType::New(); + PathType::Pointer VertexList = PathType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> PathListAlignType; + typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> PathListAlignType; PathListAlignType::Pointer testList = PathListAlignType::New(); //OTB-FA-00010-CS - testList->SetInput( reader->GetOutput() ); + testList->SetInput(reader->GetOutput()); testList->Update(); OutputPathListType * sortiePath = testList->GetOutput(); - int nbPath = sortiePath->Size(); + int nbPath = sortiePath->Size(); std::cout << "NbPath: " << nbPath << std::endl; InputImageType::ConstPointer imageIn = reader->GetOutput(); - DrawPath->SetInput( imageIn ); - DrawPath->SetInputPath( sortiePath); + DrawPath->SetInput(imageIn); + DrawPath->SetInputPath(sortiePath); writer->SetInput(DrawPath->GetOutput()); writer->Update(); diff --git a/Testing/Code/FeatureExtraction/otbExtractSegments.cxx b/Testing/Code/FeatureExtraction/otbExtractSegments.cxx index 08871de80b..d34b4637bc 100644 --- a/Testing/Code/FeatureExtraction/otbExtractSegments.cxx +++ b/Testing/Code/FeatureExtraction/otbExtractSegments.cxx @@ -30,36 +30,35 @@ #include "otbExtractSegmentsImageFilter.h" #include "itkRescaleIntensityImageFilter.h" -int otbExtractSegments( int argc, char * argv[] ) +int otbExtractSegments(int argc, char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; const char * outputFilename = argv[3]; - unsigned int PixelSuppressionRadiusX((unsigned int)::atoi(argv[4])); - float PixelSuppressionAngularBeam((float)::atof(argv[5])); + unsigned int PixelSuppressionRadiusX((unsigned int) ::atoi(argv[4])); + float PixelSuppressionAngularBeam((float) ::atof(argv[5])); - unsigned int LocalHoughRadiusX((unsigned int)::atoi(argv[6])); - unsigned int LocalHoughRadiusY((unsigned int)::atoi(argv[7])); - unsigned int LocalHoughNumberOfLines((unsigned int)::atoi(argv[8])); + unsigned int LocalHoughRadiusX((unsigned int) ::atoi(argv[6])); + unsigned int LocalHoughRadiusY((unsigned int) ::atoi(argv[7])); + unsigned int LocalHoughNumberOfLines((unsigned int) ::atoi(argv[8])); - float FillGapsRadius((float)::atof(argv[9])); - float FillGapsAngularBeam((float)::atof(argv[10])); + float FillGapsRadius((float) ::atof(argv[9])); + float FillGapsAngularBeam((float) ::atof(argv[10])); - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType1; - typedef otb::ImageFileReader< InputImageType > ReaderType2; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter<OutputImageType,OutputImageType> RescalerType; + typedef otb::ImageFileReader<InputImageType> ReaderType1; + typedef otb::ImageFileReader<InputImageType> ReaderType2; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef itk::RescaleIntensityImageFilter<OutputImageType, OutputImageType> RescalerType; - - typedef otb::ExtractSegmentsImageFilter< InputImageType, OutputImageType > FilterType; + typedef otb::ExtractSegmentsImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); @@ -69,41 +68,39 @@ int otbExtractSegments( int argc, char * argv[] ) PixelSuppressionRadius[0] = PixelSuppressionRadiusX; PixelSuppressionRadius[1] = PixelSuppressionRadiusX; - filter->SetPixelSuppressionRadius( PixelSuppressionRadius ); - filter->SetPixelSuppressionAngularBeam( PixelSuppressionAngularBeam ); + filter->SetPixelSuppressionRadius(PixelSuppressionRadius); + filter->SetPixelSuppressionAngularBeam(PixelSuppressionAngularBeam); FilterType::SizeType LocalHoughRadius; LocalHoughRadius[0] = LocalHoughRadiusX; LocalHoughRadius[1] = LocalHoughRadiusY; - filter->SetLocalHoughRadius( LocalHoughRadius ); - filter->SetLocalHoughNumberOfLines( LocalHoughNumberOfLines ); + filter->SetLocalHoughRadius(LocalHoughRadius); + filter->SetLocalHoughNumberOfLines(LocalHoughNumberOfLines); - filter->SetFillGapsRadius( FillGapsRadius ); - filter->SetFillGapsAngularBeam( FillGapsAngularBeam ); + filter->SetFillGapsRadius(FillGapsRadius); + filter->SetFillGapsAngularBeam(FillGapsAngularBeam); // Reader / Writer - ReaderType1::Pointer reader1 = ReaderType1::New(); - ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); + WriterType::Pointer writer = WriterType::New(); RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetOutputMinimum(0); rescaler->SetOutputMaximum(255); - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); - filter->SetInputImage( reader1->GetOutput() ); - filter->SetInputImageDirection( reader2->GetOutput() ); + filter->SetInputImage(reader1->GetOutput()); + filter->SetInputImageDirection(reader2->GetOutput()); rescaler->SetInput(filter->GetOutput()); - writer->SetInput( rescaler->GetOutput() ); + writer->SetInput(rescaler->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbExtractSegmentsNew.cxx b/Testing/Code/FeatureExtraction/otbExtractSegmentsNew.cxx index 1c16bcc6c2..ef1eee1863 100644 --- a/Testing/Code/FeatureExtraction/otbExtractSegmentsNew.cxx +++ b/Testing/Code/FeatureExtraction/otbExtractSegmentsNew.cxx @@ -29,21 +29,18 @@ #include "otbImageFileWriter.h" #include "otbExtractSegmentsImageFilter.h" -int otbExtractSegmentsNew( int argc, char * argv[] ) +int otbExtractSegmentsNew(int argc, char * argv[]) { - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - - typedef otb::ExtractSegmentsImageFilter< InputImageType, OutputImageType > FilterType; + typedef otb::ExtractSegmentsImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests1.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests1.cxx index 3626960841..52d898b065 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests1.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests1.cxx @@ -22,20 +22,19 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbAlignImageToPath); -REGISTER_TEST(otbDrawPathDessinCarre); -REGISTER_TEST(otbDrawPathAlign); -REGISTER_TEST(otbComplexMomentImage); -REGISTER_TEST(otbHuImage); -REGISTER_TEST(otbFlusserImage); -REGISTER_TEST(otbComplexMomentPathNew); -REGISTER_TEST(otbComplexMomentPath); -REGISTER_TEST(otbComplexMomentPathFloat); -REGISTER_TEST(otbHuPathNew); -REGISTER_TEST(otbHuPath); + REGISTER_TEST(otbAlignImageToPath); + REGISTER_TEST(otbDrawPathDessinCarre); + REGISTER_TEST(otbDrawPathAlign); + REGISTER_TEST(otbComplexMomentImage); + REGISTER_TEST(otbHuImage); + REGISTER_TEST(otbFlusserImage); + REGISTER_TEST(otbComplexMomentPathNew); + REGISTER_TEST(otbComplexMomentPath); + REGISTER_TEST(otbComplexMomentPathFloat); + REGISTER_TEST(otbHuPathNew); + REGISTER_TEST(otbHuPath); } diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests10.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests10.cxx index 7427b19fcc..ebca4a1e7d 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests10.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests10.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests11.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests11.cxx index 8cfeaf90f1..c58c98debe 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests11.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests11.cxx @@ -22,21 +22,20 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbCloudEstimatorFilterNew); -REGISTER_TEST(otbCloudEstimatorDefaultFilter); -REGISTER_TEST(otbCloudEstimatorFilter); -REGISTER_TEST(otbCloudDetectionFilterNew); -REGISTER_TEST(otbCloudDetectionFilter); -REGISTER_TEST(otbSimplifyManyPathListFilter); -REGISTER_TEST(otbLineSegmentDetectorNew); -REGISTER_TEST(otbLineSegmentDetector); -REGISTER_TEST(otbLineSpatialObjectListToRightAnglePointSetFilterNew); -REGISTER_TEST(otbLineSpatialObjectListToRightAnglePointSetFilter); -REGISTER_TEST(otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii); + REGISTER_TEST(otbCloudEstimatorFilterNew); + REGISTER_TEST(otbCloudEstimatorDefaultFilter); + REGISTER_TEST(otbCloudEstimatorFilter); + REGISTER_TEST(otbCloudDetectionFilterNew); + REGISTER_TEST(otbCloudDetectionFilter); + REGISTER_TEST(otbSimplifyManyPathListFilter); + REGISTER_TEST(otbLineSegmentDetectorNew); + REGISTER_TEST(otbLineSegmentDetector); + REGISTER_TEST(otbLineSpatialObjectListToRightAnglePointSetFilterNew); + REGISTER_TEST(otbLineSpatialObjectListToRightAnglePointSetFilter); + REGISTER_TEST(otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii); //REGISTER_TEST(otbLineSpatialObjectListToRightAnglePointSetFilterOutputImage); } diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests12.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests12.cxx index 531a27e144..b5f5a49ba3 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests12.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests12.cxx @@ -22,11 +22,10 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbTextureFunctorBase); -REGISTER_TEST(otbTextureFunctor); + REGISTER_TEST(otbTextureFunctorBase); + REGISTER_TEST(otbTextureFunctor); } diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests13.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests13.cxx index e6e70fdbd6..ce232ff267 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests13.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests13.cxx @@ -22,10 +22,9 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbTextureImageFunction); + REGISTER_TEST(otbTextureImageFunction); } diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests14.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests14.cxx index f0dd07c150..64c2741e74 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests14.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests14.cxx @@ -22,19 +22,18 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbPanTexTextureImageFilterNew); -REGISTER_TEST(otbPanTexTextureImageFilter); -REGISTER_TEST(otbPanTexTextureImageFunctionFilterNew); -REGISTER_TEST(otbPanTexTextureImageFunctionFilter); -REGISTER_TEST(otbSFSTexturesImageFilterNew); -REGISTER_TEST(otbSFSTexturesImageFilterTest); -REGISTER_TEST(otbUrbanAreaDetectionImageFilterNew); -REGISTER_TEST(otbUrbanAreaDetectionImageFilter); -REGISTER_TEST(otbRegionImageToRectangularPathListFilterNew); -REGISTER_TEST(otbRegionImageToRectangularPathListFilter); + REGISTER_TEST(otbPanTexTextureImageFilterNew); + REGISTER_TEST(otbPanTexTextureImageFilter); + REGISTER_TEST(otbPanTexTextureImageFunctionFilterNew); + REGISTER_TEST(otbPanTexTextureImageFunctionFilter); + REGISTER_TEST(otbSFSTexturesImageFilterNew); + REGISTER_TEST(otbSFSTexturesImageFilterTest); + REGISTER_TEST(otbUrbanAreaDetectionImageFilterNew); + REGISTER_TEST(otbUrbanAreaDetectionImageFilter); + REGISTER_TEST(otbRegionImageToRectangularPathListFilterNew); + REGISTER_TEST(otbRegionImageToRectangularPathListFilter); } diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests15.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests15.cxx index 683e021673..adee6ddccb 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests15.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests15.cxx @@ -22,12 +22,11 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbImageToLineSegmentVectorDataNew); -REGISTER_TEST(otbImageToLineSegmentVectorData); -REGISTER_TEST(otbSqrtSpectralAngleImageFilter); + REGISTER_TEST(otbImageToLineSegmentVectorDataNew); + REGISTER_TEST(otbImageToLineSegmentVectorData); + REGISTER_TEST(otbSqrtSpectralAngleImageFilter); } diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests2.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests2.cxx index 3288de6781..b37e5bb217 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests2.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests2.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests3.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests3.cxx index 401e6c3646..55e4d0547e 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests3.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests3.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests4.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests4.cxx index b41c1e0c19..0015ada3f9 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests4.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests4.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests5.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests5.cxx index 59c2c95768..0422e4a767 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests5.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests5.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests6.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests6.cxx index 910b196ad8..9059d3a191 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests6.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests6.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests7.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests7.cxx index 67c3994da0..82f5606727 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests7.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests7.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests8.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests8.cxx index 0db5809305..dababe996b 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests8.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests8.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests9.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests9.cxx index 5a9738e08b..f530531472 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests9.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests9.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/FeatureExtraction/otbFillGapsFilter.cxx b/Testing/Code/FeatureExtraction/otbFillGapsFilter.cxx index 538144232a..92f8f798fe 100644 --- a/Testing/Code/FeatureExtraction/otbFillGapsFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbFillGapsFilter.cxx @@ -27,45 +27,42 @@ #include "otbImageFileWriter.h" #include "otbDrawLineSpatialObjectListFilter.h" - -int otbFillGapsFilter( int argc, char * argv[] ) +int otbFillGapsFilter(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::DrawLineSpatialObjectListFilter< InputImageType,OutputImageType > FilterType; + typedef otb::DrawLineSpatialObjectListFilter<InputImageType, OutputImageType> FilterType; - typedef otb::FillGapsFilter FillGapsFilterType; - typedef otb::LineSpatialObjectList LinesListType; - typedef LinesListType::LineType LineType; + typedef otb::FillGapsFilter FillGapsFilterType; + typedef otb::LineSpatialObjectList LinesListType; + typedef LinesListType::LineType LineType; FilterType::Pointer filter = FilterType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); FillGapsFilterType::Pointer fillgaps = FillGapsFilterType::New(); - LinesListType::Pointer linesListBeforeFillGaps = LinesListType::New(); - const LinesListType *linesListAfterFillGaps; + LinesListType::Pointer linesListBeforeFillGaps = LinesListType::New(); + const LinesListType * linesListAfterFillGaps; - LineType::PointListType pointList; - LineType::LinePointType point; + LineType::PointListType pointList; + LineType::LinePointType point; // Definition of the first line double Ux, Uy, Vx, Vy; @@ -74,14 +71,14 @@ int otbFillGapsFilter( int argc, char * argv[] ) Vx = 10.; Vy = 20.; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); LineType::Pointer line = LineType::New(); line->SetId(0); - line->SetPoints( pointList ); + line->SetPoints(pointList); line->ComputeBoundingBox(); linesListBeforeFillGaps->push_back(line); @@ -95,21 +92,20 @@ int otbFillGapsFilter( int argc, char * argv[] ) Vx = 10.; Vy = 50.; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); LineType::Pointer line2 = LineType::New(); line2->SetId(0); - line2->SetPoints( pointList ); + line2->SetPoints(pointList); line2->ComputeBoundingBox(); linesListBeforeFillGaps->push_back(line2); pointList.clear(); - // Definition of a third line Ux = 20.; @@ -117,14 +113,14 @@ int otbFillGapsFilter( int argc, char * argv[] ) Vx = 50.; Vy = 50.; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); LineType::Pointer line3 = LineType::New(); line3->SetId(0); - line3->SetPoints( pointList ); + line3->SetPoints(pointList); line3->ComputeBoundingBox(); linesListBeforeFillGaps->push_back(line3); @@ -138,14 +134,11 @@ int otbFillGapsFilter( int argc, char * argv[] ) linesListAfterFillGaps = fillgaps->GetOutput(); fillgaps->Update(); - filter->SetInputLineSpatialObjectList(linesListAfterFillGaps); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbFillGapsFilterNew.cxx b/Testing/Code/FeatureExtraction/otbFillGapsFilterNew.cxx index d34a02cc65..4101dd813b 100644 --- a/Testing/Code/FeatureExtraction/otbFillGapsFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbFillGapsFilterNew.cxx @@ -23,12 +23,10 @@ #include "itkExceptionObject.h" #include "otbFillGapsFilter.h" -int otbFillGapsFilterNew( int argc, char * argv[] ) +int otbFillGapsFilterNew(int argc, char * argv[]) { typedef otb::FillGapsFilter FillGapsFilterType; FillGapsFilterType::Pointer fillgaps = FillGapsFilterType::New(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbFlusserImage.cxx b/Testing/Code/FeatureExtraction/otbFlusserImage.cxx index 454051810e..5a49e32aa6 100644 --- a/Testing/Code/FeatureExtraction/otbFlusserImage.cxx +++ b/Testing/Code/FeatureExtraction/otbFlusserImage.cxx @@ -29,65 +29,63 @@ #include "otbImageFileReader.h" #include "otbFlusserImageFunction.h" -int otbFlusserImage( int argc, char * argv[] ) +int otbFlusserImage(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int Number = 1; + unsigned int Number = 1; - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef std::complex<float> ComplexType; - typedef float RealType; - typedef otb::FlusserImageFunction<InputImageType,float,float> FunctionType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef std::complex<float> ComplexType; + typedef float RealType; + typedef otb::FlusserImageFunction<InputImageType, float, float> FunctionType; - InputImageType::RegionType region; - InputImageType::SizeType size; - InputImageType::IndexType start; + InputImageType::RegionType region; + InputImageType::SizeType size; + InputImageType::IndexType start; - start.Fill( 0 ); + start.Fill(0); size[0] = 50; size[1] = 50; - ReaderType::Pointer reader = ReaderType::New(); - FunctionType::Pointer function =FunctionType::New(); + ReaderType::Pointer reader = ReaderType::New(); + FunctionType::Pointer function = FunctionType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); InputImageType::Pointer image = reader->GetOutput(); - region.SetIndex( start ); - region.SetSize( size ); + region.SetIndex(start); + region.SetSize(size); image->SetRegions(region); image->Update(); - function->SetInputImage( image ); + function->SetInputImage(image); InputImageType::IndexType index; - index[0]=10; - index[1]=10; + index[0] = 10; + index[1] = 10; RealType Result; std::ofstream outputStream(outputFilename); - outputStream <<std::setprecision(10)<<"Flusser Image moments: [12]"<<std::endl; + outputStream << std::setprecision(10) << "Flusser Image moments: [12]" << std::endl; - for (Number = 1;Number<12;Number++) - { + for (Number = 1; Number < 12; Number++) + { //OTB-FA-00024-CS function->SetMomentNumber(Number); //OTB-FA-00025-CS function->SetNeighborhoodRadius(3); - Result = function->EvaluateAtIndex( index ); - outputStream << "Flusser("<<Number<<") = "<< Result <<std::endl; - } + Result = function->EvaluateAtIndex(index); + outputStream << "Flusser(" << Number << ") = " << Result << std::endl; + } outputStream.close(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbFlusserPath.cxx b/Testing/Code/FeatureExtraction/otbFlusserPath.cxx index ed574603d1..8881d10e10 100644 --- a/Testing/Code/FeatureExtraction/otbFlusserPath.cxx +++ b/Testing/Code/FeatureExtraction/otbFlusserPath.cxx @@ -27,54 +27,53 @@ #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" -int otbFlusserPath( int argc, char * argv[] ) +int otbFlusserPath(int argc, char * argv[]) { - unsigned int Number; - const unsigned int Dimension = 2; - const char * outputFilename = argv[1]; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::FlusserPathFunction<PathType> FunctionType; - typedef FunctionType::RealType RealType; + unsigned int Number; + const unsigned int Dimension = 2; + const char * outputFilename = argv[1]; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::FlusserPathFunction<PathType> FunctionType; + typedef FunctionType::RealType RealType; // Dessiner un carr�: PathType::ContinuousIndexType cindex; - PathType::Pointer pathElt = PathType::New(); + PathType::Pointer pathElt = PathType::New(); pathElt->Initialize(); - cindex[0]=30; - cindex[1]=30; + cindex[0] = 30; + cindex[1] = 30; pathElt->AddVertex(cindex); - cindex[0]= 30; - cindex[1]=130; + cindex[0] = 30; + cindex[1] = 130; pathElt->AddVertex(cindex); - cindex[0]=130; - cindex[1]=130; + cindex[0] = 130; + cindex[1] = 130; pathElt->AddVertex(cindex); - cindex[0]=130; - cindex[1]= 30; + cindex[0] = 130; + cindex[1] = 30; pathElt->AddVertex(cindex); - FunctionType::Pointer function =FunctionType::New(); + FunctionType::Pointer function = FunctionType::New(); //OTB-FA-00022-CS - function->SetInputPath( pathElt ); + function->SetInputPath(pathElt); std::ofstream outputStream(outputFilename); - outputStream << std::setprecision(10) << "Flusser Path moments: [12]"<<std::endl; + outputStream << std::setprecision(10) << "Flusser Path moments: [12]" << std::endl; RealType Result; - for (Number = 1;Number<12;Number++) - { + for (Number = 1; Number < 12; Number++) + { //OTB-FA-00024-CS function->SetMomentNumber(Number); - Result = function->Evaluate( ); - outputStream << "Flusser("<<Number<<") = "<< Result <<std::endl; - } + Result = function->Evaluate(); + outputStream << "Flusser(" << Number << ") = " << Result << std::endl; + } outputStream.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbFlusserPathNew.cxx b/Testing/Code/FeatureExtraction/otbFlusserPathNew.cxx index 5984851618..ce41ba6bdd 100644 --- a/Testing/Code/FeatureExtraction/otbFlusserPathNew.cxx +++ b/Testing/Code/FeatureExtraction/otbFlusserPathNew.cxx @@ -24,15 +24,13 @@ #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" -int otbFlusserPathNew( int argc, char * argv[] ) +int otbFlusserPathNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::FlusserPathFunction<PathType> FunctionType; - - FunctionType::Pointer function =FunctionType::New(); + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::FlusserPathFunction<PathType> FunctionType; + FunctionType::Pointer function = FunctionType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx index 079c983b55..3cda127813 100644 --- a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx @@ -36,40 +36,42 @@ int otbFourierMellinImageFilter(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputRealFilename = argv[2]; const char * outputImaginaryFilename = argv[3]; - typedef double InputPixelType; - typedef std::complex<double> OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< InputImageType> WriterType; - - typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType; - typedef otb::ForwardFourierMellinTransformImageFilter<InputPixelType,InterpolatorType,Dimension> FourierMellinTransformType; - typedef FourierMellinTransformType::OutputImageType OutputImageType; - typedef itk::ComplexToRealImageFilter<OutputImageType,InputImageType> RealFilterType; - typedef itk::ComplexToImaginaryImageFilter<OutputImageType,InputImageType> ImaginaryFilterType; - typedef itk::RescaleIntensityImageFilter<InputImageType,InputImageType> RescalerType; + typedef double InputPixelType; + typedef std::complex<double> OutputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<InputImageType> WriterType; + + typedef itk::LinearInterpolateImageFunction<InputImageType, double> InterpolatorType; + typedef otb::ForwardFourierMellinTransformImageFilter<InputPixelType, InterpolatorType, + Dimension> FourierMellinTransformType; + typedef FourierMellinTransformType::OutputImageType OutputImageType; + typedef itk::ComplexToRealImageFilter<OutputImageType, InputImageType> RealFilterType; + typedef itk::ComplexToImaginaryImageFilter<OutputImageType, + InputImageType> ImaginaryFilterType; + typedef itk::RescaleIntensityImageFilter<InputImageType, InputImageType> RescalerType; FourierMellinTransformType::Pointer FourierMellinTransform = FourierMellinTransformType::New(); - RealFilterType::Pointer real = RealFilterType::New(); - ImaginaryFilterType::Pointer imaginary = ImaginaryFilterType::New(); - RescalerType::Pointer realRescaler = RescalerType::New(); - RescalerType::Pointer imaginaryRescaler = RescalerType::New(); + RealFilterType::Pointer real = RealFilterType::New(); + ImaginaryFilterType::Pointer imaginary = ImaginaryFilterType::New(); + RescalerType::Pointer realRescaler = RescalerType::New(); + RescalerType::Pointer imaginaryRescaler = RescalerType::New(); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer realWriter = WriterType::New(); WriterType::Pointer imaginaryWriter = WriterType::New(); - reader->SetFileName( inputFilename ); - realWriter->SetFileName( outputRealFilename ); + reader->SetFileName(inputFilename); + realWriter->SetFileName(outputRealFilename); imaginaryWriter->SetFileName(outputImaginaryFilename); OutputImageType::SizeType size; - size[0]=512; - size[1]=256; + size[0] = 512; + size[1] = 256; - FourierMellinTransform->SetInput( reader->GetOutput() ); + FourierMellinTransform->SetInput(reader->GetOutput()); FourierMellinTransform->SetOutputSize(size); real->SetInput(FourierMellinTransform->GetOutput()); @@ -77,7 +79,7 @@ int otbFourierMellinImageFilter(int argc, char* argv[]) realRescaler->SetOutputMinimum(-1); realRescaler->SetOutputMaximum(1); - realWriter->SetInput( realRescaler->GetOutput() ); + realWriter->SetInput(realRescaler->GetOutput()); realWriter->Update(); imaginary->SetInput(FourierMellinTransform->GetOutput()); @@ -85,9 +87,8 @@ int otbFourierMellinImageFilter(int argc, char* argv[]) imaginaryRescaler->SetOutputMinimum(-1); imaginaryRescaler->SetOutputMaximum(1); - imaginaryWriter->SetInput( imaginaryRescaler->GetOutput() ); + imaginaryWriter->SetInput(imaginaryRescaler->GetOutput()); imaginaryWriter->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx index fc01da1911..60f40deaba 100644 --- a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx @@ -27,18 +27,17 @@ int otbFourierMellinImageFilterNew(int argc, char* argv[]) { - typedef double PixelType; - const unsigned int Dimension = 2; + typedef double PixelType; + const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > InputImageType; - typedef otb::Image< PixelType, Dimension > OutputImageType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; - typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType; + typedef itk::LinearInterpolateImageFunction<InputImageType, double> InterpolatorType; typedef otb::ForwardFourierMellinTransformImageFilter<PixelType, - InterpolatorType,Dimension> FourierMellinTransformType; + InterpolatorType, Dimension> FourierMellinTransformType; FourierMellinTransformType::Pointer fourierMellinTransform = FourierMellinTransformType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterTestFFT.cxx b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterTestFFT.cxx index 6f2c5178d7..92641cd5f9 100644 --- a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterTestFFT.cxx +++ b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterTestFFT.cxx @@ -31,31 +31,30 @@ int otbFourierMellinImageFilterTestFFT(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef double InputPixelType; - typedef std::complex<InputPixelType> OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef std::complex<InputPixelType> OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::VnlFFTRealToComplexConjugateImageFilter<InputPixelType,Dimension> FourierImageFilterType; + typedef itk::VnlFFTRealToComplexConjugateImageFilter<InputPixelType, Dimension> FourierImageFilterType; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; FourierImageFilterType::Pointer FourierTransform = FourierImageFilterType::New(); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - FourierTransform->SetInput( reader->GetOutput() ); - writer->SetInput( FourierTransform->GetOutput() ); + FourierTransform->SetInput(reader->GetOutput()); + writer->SetInput(FourierTransform->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbHarrisImage.cxx b/Testing/Code/FeatureExtraction/otbHarrisImage.cxx index ee7eadf283..cec7dc10c8 100644 --- a/Testing/Code/FeatureExtraction/otbHarrisImage.cxx +++ b/Testing/Code/FeatureExtraction/otbHarrisImage.cxx @@ -27,42 +27,39 @@ #include "otbImageFileWriter.h" #include "otbHarrisImageFilter.h" -int otbHarrisImage( int argc, char * argv[] ) +int otbHarrisImage(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - double SigmaD((double)::atof(argv[3])); - double SigmaI((double)::atof(argv[4])); - double Alpha((double)::atof(argv[5])); + double SigmaD((double) ::atof(argv[3])); + double SigmaI((double) ::atof(argv[4])); + double Alpha((double) ::atof(argv[5])); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; - typedef unsigned char OutputPixelType; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; + typedef unsigned char OutputPixelType; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::HarrisImageFilter<InputImageType,OutputImageType> FunctionType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::HarrisImageFilter<InputImageType, OutputImageType> FunctionType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); FunctionType::Pointer harris = FunctionType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - harris->SetInput( reader->GetOutput() ); - harris->SetSigmaD( SigmaD ); - harris->SetSigmaI( SigmaI ); - harris->SetAlpha( Alpha ); + harris->SetInput(reader->GetOutput()); + harris->SetSigmaD(SigmaD); + harris->SetSigmaI(SigmaI); + harris->SetAlpha(Alpha); - writer->SetInput( harris->GetOutput() ); + writer->SetInput(harris->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbHarrisToPointSet.cxx b/Testing/Code/FeatureExtraction/otbHarrisToPointSet.cxx index f37e5b5706..d29202ff3b 100644 --- a/Testing/Code/FeatureExtraction/otbHarrisToPointSet.cxx +++ b/Testing/Code/FeatureExtraction/otbHarrisToPointSet.cxx @@ -28,63 +28,62 @@ #include "otbHarrisImageToPointSetFilter.h" #include <fstream> -int otbHarrisToPointSet( int argc, char * argv[] ) +int otbHarrisToPointSet(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - double SigmaD((double)::atof(argv[3])); - double SigmaI((double)::atof(argv[4])); - double AlphaValue((double)::atof(argv[5])); + double SigmaD((double) ::atof(argv[3])); + double SigmaI((double) ::atof(argv[4])); + double AlphaValue((double) ::atof(argv[5])); - typedef unsigned char PixelType; - const unsigned int Dimension = 2; + typedef unsigned char PixelType; + const unsigned int Dimension = 2; - PixelType LowerThreshold((PixelType)::atoi(argv[6])); - PixelType UpperThreshold((PixelType)::atoi(argv[7])); + PixelType LowerThreshold((PixelType) ::atoi(argv[6])); + PixelType UpperThreshold((PixelType) ::atoi(argv[7])); - typedef itk::Image< PixelType, Dimension> ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::HarrisImageToPointSetFilter<ImageType> FunctionType; - typedef FunctionType::OutputPointSetType OutputPointSetType; - typedef OutputPointSetType::PointType OutputPointType; + typedef itk::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::HarrisImageToPointSetFilter<ImageType> FunctionType; + typedef FunctionType::OutputPointSetType OutputPointSetType; + typedef OutputPointSetType::PointType OutputPointType; - ReaderType::Pointer reader = ReaderType::New(); - FunctionType::Pointer harris = FunctionType::New(); - OutputPointType CoordPoint; + ReaderType::Pointer reader = ReaderType::New(); + FunctionType::Pointer harris = FunctionType::New(); + OutputPointType CoordPoint; //Initialization CoordPoint.Fill(0); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); - harris->SetInput( 0,reader->GetOutput() ); - harris->SetSigmaD( SigmaD ); - harris->SetSigmaI( SigmaI ); - harris->SetAlpha( AlphaValue ); - harris->SetLowerThreshold( LowerThreshold ); - harris->SetUpperThreshold( UpperThreshold ); + harris->SetInput(0, reader->GetOutput()); + harris->SetSigmaD(SigmaD); + harris->SetSigmaI(SigmaI); + harris->SetAlpha(AlphaValue); + harris->SetLowerThreshold(LowerThreshold); + harris->SetUpperThreshold(UpperThreshold); OutputPointSetType * pointList = harris->GetOutput(); harris->Update(); - std::cout << "Threshold Lower/Upper : "<<harris->GetLowerThreshold()<<"/"<<harris->GetUpperThreshold()<<std::endl; + std::cout << "Threshold Lower/Upper : " << harris->GetLowerThreshold() << "/" << harris->GetUpperThreshold() << + std::endl; std::ofstream file; file.open(outputFilename); - unsigned long NbPoints = pointList->GetNumberOfPoints(); - file << "NbPoints : " << NbPoints <<std::endl; + unsigned long NbPoints = pointList->GetNumberOfPoints(); + file << "NbPoints : " << NbPoints << std::endl; for (unsigned long i = 0; i < NbPoints; i++) - { - pointList->GetPoint(i,&CoordPoint); - file << i+1 <<" / " << NbPoints << " : "; - file << CoordPoint[0]<<" , "<< CoordPoint[1] << std::endl; - } + { + pointList->GetPoint(i, &CoordPoint); + file << i + 1 << " / " << NbPoints << " : "; + file << CoordPoint[0] << " , " << CoordPoint[1] << std::endl; + } file.close(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbHoughTransform2DLinesImageTest.cxx b/Testing/Code/FeatureExtraction/otbHoughTransform2DLinesImageTest.cxx index b6d186fce0..ffe3e84386 100644 --- a/Testing/Code/FeatureExtraction/otbHoughTransform2DLinesImageTest.cxx +++ b/Testing/Code/FeatureExtraction/otbHoughTransform2DLinesImageTest.cxx @@ -27,7 +27,6 @@ #include <list> - #include "otbImageFileWriter.h" /** @@ -49,82 +48,78 @@ struct houghPoint }; /** Main program */ -int otbHoughTransform2DLinesImageTest(int argc , char* argv[]) +int otbHoughTransform2DLinesImageTest(int argc, char* argv[]) { const char * outputFilename = argv[1]; - /** Typedefs */ - typedef unsigned char PixelType; - typedef double HoughSpacePixelType; - typedef itk::Image< HoughSpacePixelType, 2> HoughImageType; - typedef itk::Image< PixelType, 2> ImageType; - typedef otb::ImageFileWriter< HoughImageType> WriterType; - + typedef unsigned char PixelType; + typedef double HoughSpacePixelType; + typedef itk::Image<HoughSpacePixelType, 2> HoughImageType; + typedef itk::Image<PixelType, 2> ImageType; + typedef otb::ImageFileWriter<HoughImageType> WriterType; itk::Index<2> m_Index; /** Create a line image with one line */ std::cout << "Creating simulated image" << std::endl; - ImageType::Pointer m_Image = ImageType::New(); + ImageType::Pointer m_Image = ImageType::New(); ImageType::RegionType region; - ImageType::SizeType size; + ImageType::SizeType size; size.Fill(100); ImageType::IndexType index; index.Fill(0); region.SetSize(size); region.SetIndex(index); - m_Image->SetRegions( region ); + m_Image->SetRegions(region); m_Image->Allocate(); m_Image->FillBuffer(0); - /** Create a line */ float teta = 0.20; // radians float radius = 50; - double Vx = radius*cos( teta ); - double Vy = radius*sin( teta ); - - double norm = sqrt(Vx*Vx+Vy*Vy); - double VxNorm = Vx/norm; - double VyNorm = Vy/norm; + double Vx = radius * cos(teta); + double Vy = radius * sin(teta); - unsigned int maxval = size[0]*size[1]; + double norm = sqrt(Vx * Vx + Vy * Vy); + double VxNorm = Vx / norm; + double VyNorm = Vy / norm; - const double nPI = 4.0 * vcl_atan( 1.0 ); + unsigned int maxval = size[0] * size[1]; - for (unsigned int i=0;i<maxval;i+=1) - { - m_Index[0]=(long int)(Vx-VyNorm*i); - m_Index[1]=(long int)(Vy+VxNorm*i); + const double nPI = 4.0 * vcl_atan(1.0); - if ( ((m_Index[0]<(long)size[0]) && (m_Index[0]>=0)) - && ((m_Index[1]<(long)size[1]) && (m_Index[1]>=0)) - ) + for (unsigned int i = 0; i < maxval; i += 1) { - m_Image->SetPixel(m_Index,255); + m_Index[0] = (long int) (Vx - VyNorm * i); + m_Index[1] = (long int) (Vy + VxNorm * i); + + if (((m_Index[0] < (long) size[0]) && (m_Index[0] >= 0)) + && ((m_Index[1] < (long) size[1]) && (m_Index[1] >= 0)) + ) + { + m_Image->SetPixel(m_Index, 255); + } } - } /** Allocate Hough Space image (accumulator) */ std::cout << "Allocating Hough Space Image" << std::endl; HoughImageType::Pointer m_HoughSpaceImage = HoughImageType::New(); - m_HoughSpaceImage->SetRegions( region ); + m_HoughSpaceImage->SetRegions(region); m_HoughSpaceImage->Allocate(); /** Apply gradient filter to the input image */ typedef itk::CastImageFilter< - ImageType, - HoughImageType > CastingFilterType; + ImageType, + HoughImageType> CastingFilterType; CastingFilterType::Pointer caster = CastingFilterType::New(); caster->SetInput(m_Image); - std::cout << "Applying gradient magnitude filter" << std::endl; - typedef itk::GradientMagnitudeImageFilter<HoughImageType,HoughImageType> GradientFilterType; + typedef itk::GradientMagnitudeImageFilter<HoughImageType, HoughImageType> GradientFilterType; GradientFilterType::Pointer gradFilter = GradientFilterType::New(); gradFilter->SetInput(caster->GetOutput()); gradFilter->Update(); @@ -137,11 +132,11 @@ int otbHoughTransform2DLinesImageTest(int argc , char* argv[]) threshFilter->SetOutsideValue(0); unsigned char thresh_below = 10; unsigned char thresh_above = 200; - threshFilter->ThresholdOutside(thresh_below,thresh_above); + threshFilter->ThresholdOutside(thresh_below, thresh_above); threshFilter->Update(); /** Define the HoughTransform filter */ - typedef otb::HoughTransform2DLinesImageFilter<HoughSpacePixelType,HoughSpacePixelType> HoughTransformFilterType; + typedef otb::HoughTransform2DLinesImageFilter<HoughSpacePixelType, HoughSpacePixelType> HoughTransformFilterType; HoughTransformFilterType::Pointer houghFilter = HoughTransformFilterType::New(); @@ -149,26 +144,26 @@ int otbHoughTransform2DLinesImageTest(int argc , char* argv[]) houghFilter->SetThreshold(0.0f); if (houghFilter->GetThreshold() != 0.0f) - { + { std::cout << "Failure" << std::endl; return EXIT_FAILURE; - } + } //houghFilter->SetAngleResolution(500.0f); houghFilter->SetDiscRadius(10.0f); if (houghFilter->GetDiscRadius() != 10.0f) - { + { std::cout << "Failure" << std::endl; return EXIT_FAILURE; - } + } houghFilter->SetVariance(10.0f); if (houghFilter->GetVariance() != 10.0f) - { + { std::cout << "Failure" << std::endl; return EXIT_FAILURE; - } + } houghFilter->Update(); houghFilter->Simplify(); @@ -176,21 +171,19 @@ int otbHoughTransform2DLinesImageTest(int argc , char* argv[]) HoughImageType::Pointer m_SimplifyAccumulator = houghFilter->GetSimplifyAccumulator(); HoughImageType::Pointer m_Accumulator = houghFilter->GetOutput(); - WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); + writer->SetFileName(outputFilename); writer->SetInput(m_Accumulator); writer->Update(); - /** Blur the accumulator in order to find the maximum */ HoughImageType::Pointer m_PostProcessImage = HoughImageType::New(); - typedef itk::DiscreteGaussianImageFilter<HoughImageType,HoughImageType> GaussianFilterType; + typedef itk::DiscreteGaussianImageFilter<HoughImageType, HoughImageType> GaussianFilterType; GaussianFilterType::Pointer gaussianFilter = GaussianFilterType::New(); gaussianFilter->SetInput(m_Accumulator); double variance[2]; - variance[0]=10; - variance[1]=10; + variance[0] = 10; + variance[1] = 10; gaussianFilter->SetVariance(variance); gaussianFilter->SetMaximumError(.01f); gaussianFilter->Update(); @@ -199,89 +192,85 @@ int otbHoughTransform2DLinesImageTest(int argc , char* argv[]) typedef itk::MinimumMaximumImageCalculator<HoughImageType> MinMaxCalculatorType; MinMaxCalculatorType::Pointer minMaxCalculator = MinMaxCalculatorType::New(); - itk::ImageRegionIterator<HoughImageType> it_output(m_HoughSpaceImage,m_HoughSpaceImage->GetLargestPossibleRegion()); - itk::ImageRegionIterator<HoughImageType> it_input(m_PostProcessImage,m_PostProcessImage->GetLargestPossibleRegion()); + itk::ImageRegionIterator<HoughImageType> it_output(m_HoughSpaceImage, m_HoughSpaceImage->GetLargestPossibleRegion()); + itk::ImageRegionIterator<HoughImageType> it_input(m_PostProcessImage, m_PostProcessImage->GetLargestPossibleRegion()); /** Set the number of lines we are looking for. */ - unsigned int m_NumberOfLines=1; + unsigned int m_NumberOfLines = 1; /** Each time we find a maximum we remove it by drawing a black disc this define the size of this disc */ - unsigned int m_HoughDiscRadius=10; + unsigned int m_HoughDiscRadius = 10; - unsigned int lines=0; + unsigned int lines = 0; std::list<houghPoint> m_LinesList; /** Find maxima */ do - { + { minMaxCalculator->SetImage(m_PostProcessImage); minMaxCalculator->ComputeMaximum(); - HoughImageType::PixelType max = minMaxCalculator->GetMaximum(); + HoughImageType::PixelType max = minMaxCalculator->GetMaximum(); - for (it_input.GoToBegin();!it_input.IsAtEnd();++it_input) - { - if (it_input.Get() == max) + for (it_input.GoToBegin(); !it_input.IsAtEnd(); ++it_input) { + if (it_input.Get() == max) + { houghPoint m_HoughPoint; m_HoughPoint.radius = it_input.GetIndex()[0]; - m_HoughPoint.angle = ((it_input.GetIndex()[1])*2*nPI/houghFilter->GetAngleAxisSize())-nPI; + m_HoughPoint.angle = ((it_input.GetIndex()[1]) * 2 * nPI / houghFilter->GetAngleAxisSize()) - nPI; m_LinesList.push_back(m_HoughPoint); // Remove a black disc from the hough space domain - for (double angle = 0; angle <= 2 * nPI; angle += nPI / 1000 ) - { - for (double length = 0; length < m_HoughDiscRadius;length += 1) + for (double angle = 0; angle <= 2 * nPI; angle += nPI / 1000) { - m_Index[0] = (long int)(it_input.GetIndex()[0] + length * cos(angle)); - m_Index[1] = (long int)(it_input.GetIndex()[1] + length * sin(angle)); - if ( ((m_Index[0]<=sqrt((double)400*400+400*400)) && (m_Index[0]>=0)) - && ((m_Index[1]<=500) && (m_Index[1]>=0)) - ) + for (double length = 0; length < m_HoughDiscRadius; length += 1) { - m_Accumulator->SetPixel(m_Index,0); + m_Index[0] = (long int) (it_input.GetIndex()[0] + length * cos(angle)); + m_Index[1] = (long int) (it_input.GetIndex()[1] + length * sin(angle)); + if (((m_Index[0] <= sqrt((double) 400 * 400 + 400 * 400)) && (m_Index[0] >= 0)) + && ((m_Index[1] <= 500) && (m_Index[1] >= 0)) + ) + { + m_Accumulator->SetPixel(m_Index, 0); + } } } - } minMaxCalculator->SetImage(m_Accumulator); minMaxCalculator->ComputeMaximum(); max = minMaxCalculator->GetMaximum(); lines++; if (lines == m_NumberOfLines) break; + } } } - } - while (lines<m_NumberOfLines); - + while (lines < m_NumberOfLines); std::list<houghPoint>::iterator it_list = m_LinesList.begin(); while (it_list != m_LinesList.end()) - { - std::cout << "Angle = " << it_list->angle << " (expected " << teta << ")"<< std::endl; - std::cout << "Radius = " << it_list->radius << " (expected " << radius << ")"<< std::endl; - - if (fabs(it_list->angle-teta)>0.1) { + std::cout << "Angle = " << it_list->angle << " (expected " << teta << ")" << std::endl; + std::cout << "Radius = " << it_list->radius << " (expected " << radius << ")" << std::endl; + + if (fabs(it_list->angle - teta) > 0.1) + { std::cout << "Failure" << std::endl; //return EXIT_FAILURE; - } - if (fabs(it_list->radius-radius)>1.0) - { + } + if (fabs(it_list->radius - radius) > 1.0) + { std::cout << "Failure" << std::endl; //return EXIT_FAILURE; - } + } it_list++; - } + } std::cout << "Printing Hough Fiter information:" << std::endl; std::cout << houghFilter << std::endl; std::cout << "Hough Transform Successful" << std::endl; - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbHuImage.cxx b/Testing/Code/FeatureExtraction/otbHuImage.cxx index 29f34d341f..2c657683fd 100644 --- a/Testing/Code/FeatureExtraction/otbHuImage.cxx +++ b/Testing/Code/FeatureExtraction/otbHuImage.cxx @@ -29,63 +29,61 @@ #include "otbImageFileReader.h" #include "otbHuImageFunction.h" -int otbHuImage( int argc, char * argv[] ) +int otbHuImage(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int Number = 1; + unsigned int Number = 1; - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef std::complex<float> ComplexType; - typedef float RealType; - typedef otb::HuImageFunction<InputImageType,float,float> FunctionType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef std::complex<float> ComplexType; + typedef float RealType; + typedef otb::HuImageFunction<InputImageType, float, float> FunctionType; - InputImageType::RegionType region; - InputImageType::SizeType size; - InputImageType::IndexType start; + InputImageType::RegionType region; + InputImageType::SizeType size; + InputImageType::IndexType start; - start.Fill( 0 ); + start.Fill(0); size[0] = 50; size[1] = 50; - ReaderType::Pointer reader = ReaderType::New(); - FunctionType::Pointer function =FunctionType::New(); + ReaderType::Pointer reader = ReaderType::New(); + FunctionType::Pointer function = FunctionType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); InputImageType::Pointer image = reader->GetOutput(); - region.SetIndex( start ); - region.SetSize( size ); + region.SetIndex(start); + region.SetSize(size); image->SetRegions(region); image->Update(); - function->SetInputImage( image ); + function->SetInputImage(image); InputImageType::IndexType index; - index[0]=10; - index[1]=10; + index[0] = 10; + index[1] = 10; RealType Result; std::ofstream outputStream(outputFilename); - outputStream << std::setprecision(10) << "Hu Image moments: [10]"<<std::endl; - for (Number = 1;Number<10;Number++) - { + outputStream << std::setprecision(10) << "Hu Image moments: [10]" << std::endl; + for (Number = 1; Number < 10; Number++) + { //OTB-FA-00024-CS function->SetMomentNumber(Number); //OTB-FA-00025-CS function->SetNeighborhoodRadius(3); - Result = function->EvaluateAtIndex( index ); - outputStream << "Hu("<<Number<<") = "<< Result <<std::endl; - } + Result = function->EvaluateAtIndex(index); + outputStream << "Hu(" << Number << ") = " << Result << std::endl; + } outputStream.close(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbHuPath.cxx b/Testing/Code/FeatureExtraction/otbHuPath.cxx index 528a9f06b0..f06a6fe51e 100644 --- a/Testing/Code/FeatureExtraction/otbHuPath.cxx +++ b/Testing/Code/FeatureExtraction/otbHuPath.cxx @@ -28,52 +28,50 @@ #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" -int otbHuPath( int argc, char * argv[] ) +int otbHuPath(int argc, char * argv[]) { - unsigned int Number; - const unsigned int Dimension = 2; - const char * outputFilename = argv[1]; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::HuPathFunction<PathType> FunctionType; - typedef FunctionType::RealType RealType; - + unsigned int Number; + const unsigned int Dimension = 2; + const char * outputFilename = argv[1]; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::HuPathFunction<PathType> FunctionType; + typedef FunctionType::RealType RealType; // Dessiner un carre: PathType::ContinuousIndexType cindex; - PathType::Pointer pathElt = PathType::New(); + PathType::Pointer pathElt = PathType::New(); pathElt->Initialize(); - cindex[0]=30; - cindex[1]=30; + cindex[0] = 30; + cindex[1] = 30; pathElt->AddVertex(cindex); - cindex[0]= 30; - cindex[1]=130; + cindex[0] = 30; + cindex[1] = 130; pathElt->AddVertex(cindex); - cindex[0]=130; - cindex[1]=130; + cindex[0] = 130; + cindex[1] = 130; pathElt->AddVertex(cindex); - cindex[0]=130; - cindex[1]= 30; + cindex[0] = 130; + cindex[1] = 30; pathElt->AddVertex(cindex); - FunctionType::Pointer function =FunctionType::New(); + FunctionType::Pointer function = FunctionType::New(); RealType Result; - function->SetInputPath( pathElt ); + function->SetInputPath(pathElt); std::ofstream outputStream(outputFilename); - outputStream << std::setprecision(10) << "Hu Path moments: [8]"<<std::endl; + outputStream << std::setprecision(10) << "Hu Path moments: [8]" << std::endl; - for (Number = 1;Number<8;Number++) - { + for (Number = 1; Number < 8; Number++) + { //OTB-FA-00024-CS function->SetMomentNumber(Number); Result = function->Evaluate(); - outputStream << "Hu("<<Number<<") = "<< Result <<std::endl; - } + outputStream << "Hu(" << Number << ") = " << Result << std::endl; + } outputStream.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbHuPathNew.cxx b/Testing/Code/FeatureExtraction/otbHuPathNew.cxx index 59fca64d79..21af12562b 100644 --- a/Testing/Code/FeatureExtraction/otbHuPathNew.cxx +++ b/Testing/Code/FeatureExtraction/otbHuPathNew.cxx @@ -24,16 +24,14 @@ #include "otbHuPathFunction.h" #include "itkPolyLineParametricPath.h" -int otbHuPathNew( int argc, char * argv[] ) +int otbHuPathNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::HuPathFunction<PathType> FunctionType; - typedef FunctionType::RealType RealType; - - FunctionType::Pointer function =FunctionType::New(); + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::HuPathFunction<PathType> FunctionType; + typedef FunctionType::RealType RealType; + FunctionType::Pointer function = FunctionType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilter.cxx b/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilter.cxx index ab499cd1d4..426e67a9a3 100644 --- a/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilter.cxx @@ -34,28 +34,28 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) const char * imageFileName = argv[1]; const char * polyFileName = argv[2]; const char * outFileName = argv[3]; - const int fittingRadius = atoi(argv[4]); - const int fittingIters = atoi(argv[5]); + const int fittingRadius = atoi(argv[4]); + const int fittingIters = atoi(argv[5]); - const unsigned int Dimension =2; - typedef otb::Polygon<double> PolygonType; - typedef otb::Image<double,Dimension> ImageType; + const unsigned int Dimension = 2; + typedef otb::Polygon<double> PolygonType; + typedef otb::Image<double, Dimension> ImageType; //Read the reference image and extract its contours typedef otb::ImageFileReader<ImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(imageFileName); - typedef itk::CannyEdgeDetectionImageFilter<ImageType,ImageType> CannyFilterType; + typedef itk::CannyEdgeDetectionImageFilter<ImageType, ImageType> CannyFilterType; CannyFilterType::Pointer canny = CannyFilterType::New(); canny->SetInput(reader->GetOutput()); //Read the original polygon list (kml file) - typedef otb::VectorData<> VectorDataType; - typedef VectorDataType::DataTreeType DataTreeType; - typedef itk::PreOrderTreeIterator<DataTreeType> TreeIteratorType; - typedef VectorDataType::DataNodeType DataNodeType; - typedef DataNodeType::Pointer DataNodePointerType; + typedef otb::VectorData<> VectorDataType; + typedef VectorDataType::DataTreeType DataTreeType; + typedef itk::PreOrderTreeIterator<DataTreeType> TreeIteratorType; + typedef VectorDataType::DataNodeType DataNodeType; + typedef DataNodeType::Pointer DataNodePointerType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer readerVector = VectorDataFileReaderType::New(); @@ -70,17 +70,17 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) it.GoToBegin(); while (!it.IsAtEnd()) - { + { DataNodePointerType dataNode = it.Get(); if (dataNode->IsPolygonFeature()) - { + { polygonList->PushBack(dataNode->GetPolygonExteriorRing()); - } + } ++it; - } + } //Fit the polygons on the image - typedef otb::ImageFittingPolygonListFilter<PolygonType,ImageType> FittingPolygonType; + typedef otb::ImageFittingPolygonListFilter<PolygonType, ImageType> FittingPolygonType; FittingPolygonType::Pointer fittingPolygon = FittingPolygonType::New(); fittingPolygon->SetInput(polygonList); @@ -89,7 +89,6 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) fittingPolygon->SetNumberOfIterations(fittingIters); fittingPolygon->Update(); - //Write the improved polygon list (kml file) VectorDataType::Pointer data = VectorDataType::New(); @@ -104,20 +103,20 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get(); - data->GetDataTree()->Add(document,root); - data->GetDataTree()->Add(folder,document); + data->GetDataTree()->Add(document, root); + data->GetDataTree()->Add(folder, document); typedef PolygonListType::ConstIterator ListIteratorType; ListIteratorType listIt = fittingPolygon->GetOutput()->Begin(); while (listIt != fittingPolygon->GetOutput()->End()) - { + { DataNodeType::Pointer polygon = DataNodeType::New(); polygon->SetNodeType(otb::FEATURE_POLYGON); polygon->SetNodeId("FEATURE_POLYGON"); polygon->SetPolygonExteriorRing(listIt.Get()); - data->GetDataTree()->Add(polygon,folder); + data->GetDataTree()->Add(polygon, folder); ++listIt; - } + } typedef otb::VectorDataFileWriter<VectorDataType> WriterType; WriterType::Pointer writer = WriterType::New(); diff --git a/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx index 2ac97d8777..174d46f687 100644 --- a/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx @@ -24,11 +24,11 @@ int otbImageFittingPolygonListFilterNew(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef otb::Polygon<double> PolygonType; - typedef otb::Image<double,Dimension> ImageType; + const unsigned int Dimension = 2; + typedef otb::Polygon<double> PolygonType; + typedef otb::Image<double, Dimension> ImageType; - typedef otb::ImageFittingPolygonListFilter<PolygonType,ImageType> FittingPolygonType; + typedef otb::ImageFittingPolygonListFilter<PolygonType, ImageType> FittingPolygonType; // Instantiating object FittingPolygonType::Pointer fittingPolygon = FittingPolygonType::New(); diff --git a/Testing/Code/FeatureExtraction/otbImageToCarvingPathFilterNew.cxx b/Testing/Code/FeatureExtraction/otbImageToCarvingPathFilterNew.cxx index f756fe6c49..bc5098f4be 100644 --- a/Testing/Code/FeatureExtraction/otbImageToCarvingPathFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToCarvingPathFilterNew.cxx @@ -27,16 +27,15 @@ int otbImageToCarvingPathFilterNew(int argc, char* argv[]) { - typedef double PixelType; - const unsigned int Dimension = 2; + typedef double PixelType; + const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > InputImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::ImageToCarvingPathFilter<InputImageType, PathType> ImageToCarvingPathFilterType; + typedef otb::ImageToCarvingPathFilter<InputImageType, PathType> ImageToCarvingPathFilterType; ImageToCarvingPathFilterType::Pointer addCarvingPathFilter = ImageToCarvingPathFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbImageToEdgePathFilter.cxx b/Testing/Code/FeatureExtraction/otbImageToEdgePathFilter.cxx index db37bb9f40..81addeb2ac 100644 --- a/Testing/Code/FeatureExtraction/otbImageToEdgePathFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToEdgePathFilter.cxx @@ -25,70 +25,70 @@ int otbImageToEdgePathFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - const unsigned int foreground((const unsigned int)::atoi(argv[3])); + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + const unsigned int foreground((const unsigned int) ::atoi(argv[3])); const unsigned int Dimension = 2; - typedef unsigned char PixelType; + typedef unsigned char PixelType; typedef otb::Image<PixelType, Dimension> ImageType; - typedef ImageType::IndexType IndexType; + typedef ImageType::IndexType IndexType; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::ImageFileWriter< ImageType > WriterType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::ImageToEdgePathFilter<ImageType,PathType> ImageToEdgePathFilterType; + typedef otb::ImageToEdgePathFilter<ImageType, PathType> ImageToEdgePathFilterType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); ImageToEdgePathFilterType::Pointer pathFilter = ImageToEdgePathFilterType::New(); - PixelType foregroundValue(foreground); + PixelType foregroundValue(foreground); pathFilter->SetForegroundValue(foregroundValue); - pathFilter->SetInput( reader->GetOutput() ); + pathFilter->SetInput(reader->GetOutput()); pathFilter->Update(); - std::cout << " pathFilter = "<<pathFilter<<std::endl; + std::cout << " pathFilter = " << pathFilter << std::endl; PathType * outputPath = pathFilter->GetOutput(); - typedef PathType::VertexType VertexType; - typedef PathType::VertexListType VertexListType; - typedef PathType::VertexListType::ConstIterator VertexListConstIterator; - typedef VertexListType::ConstPointer VertexListTypePointer; + typedef PathType::VertexType VertexType; + typedef PathType::VertexListType VertexListType; + typedef PathType::VertexListType::ConstIterator VertexListConstIterator; + typedef VertexListType::ConstPointer VertexListTypePointer; VertexListTypePointer vertexList; - VertexType cindex; + VertexType cindex; VertexListTypePointer ptrVertexList = outputPath->GetVertexList(); - std::cout << "Size : "<<ptrVertexList->Size() <<std::endl; + std::cout << "Size : " << ptrVertexList->Size() << std::endl; // Initialize Output Image ImageType::Pointer outputImage = ImageType::New(); - typedef itk::ImageRegionIteratorWithIndex< ImageType> IteratorType; - outputImage->SetRegions( reader->GetOutput()->GetLargestPossibleRegion() ); + typedef itk::ImageRegionIteratorWithIndex<ImageType> IteratorType; + outputImage->SetRegions(reader->GetOutput()->GetLargestPossibleRegion()); outputImage->Allocate(); outputImage->FillBuffer(255); // Create one iterator for the Input Image (this is a light object) - IteratorType it( outputImage, outputImage->GetBufferedRegion() ); + IteratorType it(outputImage, outputImage->GetBufferedRegion()); - for (unsigned int cpt=0; cpt< ptrVertexList->Size(); cpt++) - { - std::cout <<" Point "<<cpt<<" : "<< ptrVertexList->GetElement(cpt)<<std::endl; + for (unsigned int cpt = 0; cpt < ptrVertexList->Size(); cpt++) + { + std::cout << " Point " << cpt << " : " << ptrVertexList->GetElement(cpt) << std::endl; IndexType pos; pos[0] = static_cast<unsigned long>(ptrVertexList->GetElement(cpt)[0]); pos[1] = static_cast<unsigned long>(ptrVertexList->GetElement(cpt)[1]); - outputImage->SetPixel(pos,0); + outputImage->SetPixel(pos, 0); - } + } WriterType::Pointer writer = WriterType::New(); writer->SetInput(outputImage); - writer->SetFileName( outputFilename ); + writer->SetFileName(outputFilename); writer->Update(); /* VertexListConstIterator iter=ptrVertexList->Begin(); @@ -100,7 +100,6 @@ int otbImageToEdgePathFilter(int argc, char * argv[]) } */ - /* x1 = cindex[0]; y1 = cindex[1]; cindex = vertexList->GetElement(1); @@ -109,8 +108,5 @@ int otbImageToEdgePathFilter(int argc, char * argv[]) fprintf(file,"%8.4f %8.3f\n",x1,y1); */ - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbImageToEdgePathFilterNew.cxx b/Testing/Code/FeatureExtraction/otbImageToEdgePathFilterNew.cxx index 1fb1a5d297..051cc83357 100644 --- a/Testing/Code/FeatureExtraction/otbImageToEdgePathFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToEdgePathFilterNew.cxx @@ -23,16 +23,13 @@ int otbImageToEdgePathFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef itk::PolyLineParametricPath< Dimension > PathType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::ImageToEdgePathFilter<ImageType,PathType> ImageToEdgePathFilterType; + typedef otb::ImageToEdgePathFilter<ImageType, PathType> ImageToEdgePathFilterType; ImageToEdgePathFilterType::Pointer pathFilter = ImageToEdgePathFilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterNew.cxx b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterNew.cxx index 9c691fce60..037287cbd0 100644 --- a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterNew.cxx @@ -23,12 +23,12 @@ int otbImageToFastSIFTKeyPointSetFilterNew(int argc, char * argv[]) { typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::SiftFastImageFilter<ImageType,PointSetType> ImageToFastSIFTKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::SiftFastImageFilter<ImageType, PointSetType> ImageToFastSIFTKeyPointSetFilterType; // Instantiating object ImageToFastSIFTKeyPointSetFilterType::Pointer object = ImageToFastSIFTKeyPointSetFilterType::New(); diff --git a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii.cxx index 87c3583482..2b39196932 100644 --- a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii.cxx @@ -27,9 +27,9 @@ #include <fstream> #include <algorithm> -bool CMPData(std::vector<float> a ,std::vector<float> b ) +bool CMPData(std::vector<float> a, std::vector<float> b) { - return lexicographical_compare(a.begin(),a.begin()+2 , b.begin(),b.begin()+2); + return lexicographical_compare(a.begin(), a.begin() + 2, b.begin(), b.begin() + 2); } int otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii(int argc, char * argv[]) @@ -40,88 +40,86 @@ int otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii(int argc, char * ar const unsigned int scales = atoi(argv[3]); typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::SiftFastImageFilter<ImageType,PointSetType> ImageToFastSIFTKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::SiftFastImageFilter<ImageType, PointSetType> ImageToFastSIFTKeyPointSetFilterType; // PointSet iterator types - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; - typedef std::vector<float> siftDataVector; + typedef std::vector<float> siftDataVector; typedef std::vector<siftDataVector> ImageDataType; //Kind of PointSet with vectors // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImageToFastSIFTKeyPointSetFilterType::Pointer filter = ImageToFastSIFTKeyPointSetFilterType::New(); //Instantiation of std::vector for lexicographiacal sorting - ImageDataType imageData; + ImageDataType imageData; reader->SetFileName(infname); filter->SetInput(reader->GetOutput()); filter->SetScalesNumber(scales); filter->Update(); - PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); + PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); PointDataIteratorType pDataIt = filter->GetOutput()->GetPointData()->Begin(); std::ofstream outfile(outfname); - outfile << "Number of scales: "<<scales << std::endl; + outfile << "Number of scales: " << scales << std::endl; outfile << "Number of SIFT key points: " << filter->GetOutput()->GetNumberOfPoints() << std::endl; - if(filter->GetOutput()->GetPointData()->Size() != filter->GetOutput()->GetPoints()->Size() ) - return EXIT_FAILURE; - if(filter->GetOutput()->GetPointData()->Size() == 0 ) - return EXIT_FAILURE; + if (filter->GetOutput()->GetPointData()->Size() != filter->GetOutput()->GetPoints()->Size()) return EXIT_FAILURE; + if (filter->GetOutput()->GetPointData()->Size() == 0) return EXIT_FAILURE; // Copy the PointSet to std::vector< std::vector > - while ( pIt!=filter->GetOutput()->GetPoints()->End() && pDataIt!=filter->GetOutput()->GetPointData()->End() ) - { + while (pIt != filter->GetOutput()->GetPoints()->End() && pDataIt != filter->GetOutput()->GetPointData()->End()) + { siftDataVector siftData; siftData.push_back(pIt.Value()[0]); siftData.push_back(pIt.Value()[1]); - unsigned int lIterDesc=0; + unsigned int lIterDesc = 0; while (lIterDesc < pDataIt.Value().Size()) - { + { siftData.push_back(pDataIt.Value()[lIterDesc]); lIterDesc++; - } + } imageData.push_back(siftData); ++pIt; ++pDataIt; - } + } //Sorting the vectors ImageDataType::iterator itData; - sort(imageData.begin() , imageData.end(),CMPData); + sort(imageData.begin(), imageData.end(), CMPData); itData = imageData.begin(); unsigned int stopVal = static_cast<unsigned int>(filter->GetOutput()->GetPointData()->Begin().Value().Size()); - while ( itData != imageData.end() ) - { - unsigned int itDescriptor = 0; - outfile << "[ "; - while (itDescriptor < stopVal ) + while (itData != imageData.end()) + { + unsigned int itDescriptor = 0; + outfile << "[ "; + while (itDescriptor < stopVal) //while (itDescriptor < static_cast<int>((*itData).size()-2) ) - { - outfile << std::fixed << std::setprecision(4) << (*itData)[itDescriptor+2] << " "; + { + outfile << std::fixed << std::setprecision(4) << (*itData)[itDescriptor + 2] << " "; itDescriptor++; - } + } outfile << "]" << std::endl; ++itData; - } + } outfile.close(); diff --git a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx index f84bcb6184..945cdca37a 100644 --- a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx @@ -28,13 +28,11 @@ #include <fstream> #include <algorithm> - -bool CMP(std::vector<float> a ,std::vector<float> b ) +bool CMP(std::vector<float> a, std::vector<float> b) { - return lexicographical_compare(a.begin(),a.begin()+2 , b.begin(),b.begin()+2); + return lexicographical_compare(a.begin(), a.begin() + 2, b.begin(), b.begin() + 2); } - int otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii(int argc, char * argv[]) { @@ -43,80 +41,77 @@ int otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii(int argc, char * const unsigned int scales = atoi(argv[3]); typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; - typedef otb::SiftFastImageFilter<ImageType,PointSetType> ImageToFastSIFTKeyPointSetFilterType; + typedef otb::SiftFastImageFilter<ImageType, PointSetType> ImageToFastSIFTKeyPointSetFilterType; // PointSet iterator types - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; - typedef std::vector<float> siftDataVector; + typedef std::vector<float> siftDataVector; typedef std::vector<siftDataVector> ImageDataType; //Kind of PointSet with vectors // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImageToFastSIFTKeyPointSetFilterType::Pointer filter = ImageToFastSIFTKeyPointSetFilterType::New(); //Instantiation of std::vector for lexicographiacal sorting - ImageDataType imageData; + ImageDataType imageData; reader->SetFileName(infname); filter->SetInput(reader->GetOutput()); filter->SetScalesNumber(scales); filter->Update(); - PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); + PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); PointDataIteratorType pDataIt = filter->GetOutput()->GetPointData()->Begin(); - std::ofstream outfile(outfname); - outfile << "Number of scales: "<<scales << std::endl; + outfile << "Number of scales: " << scales << std::endl; outfile << "Number of SIFT key points: " << filter->GetOutput()->GetNumberOfPoints() << std::endl; - // Copy the PointSet to std::vector< std::vector > - while ( pIt!=filter->GetOutput()->GetPoints()->End() ) - { + while (pIt != filter->GetOutput()->GetPoints()->End()) + { siftDataVector siftData; siftData.push_back(pIt.Value()[0]); siftData.push_back(pIt.Value()[1]); - unsigned int lIterDesc=0; + unsigned int lIterDesc = 0; while (lIterDesc < pDataIt.Value().Size()) - { + { siftData.push_back(pDataIt.Value()[lIterDesc]); lIterDesc++; - } + } imageData.push_back(siftData); ++pIt; ++pDataIt; - } + } //Sorting the vectors ImageDataType::iterator itData; - sort(imageData.begin() , imageData.end(),CMP); + sort(imageData.begin(), imageData.end(), CMP); itData = imageData.begin(); - while ( itData != imageData.end() ) - { - outfile << "[" << std::fixed << std::setprecision(1) << (*itData)[0] << ", " << std::setprecision(1) << (*itData)[1] << "]" << endl; + while (itData != imageData.end()) + { + outfile << "[" << std::fixed << std::setprecision(1) << (*itData)[0] << ", " << std::setprecision(1) << + (*itData)[1] << "]" << endl; ++itData; - } + } outfile.close(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilter.cxx b/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilter.cxx index 31491b6c12..859a0fd06b 100644 --- a/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilter.cxx @@ -30,11 +30,11 @@ int otbImageToHessianDeterminantImageFilter(int argc, char * argv[]) const double sigma = atof(argv[3]); const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageToHessianDeterminantImageFilter<ImageType,ImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageToHessianDeterminantImageFilter<ImageType, ImageType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); @@ -50,6 +50,5 @@ int otbImageToHessianDeterminantImageFilter(int argc, char * argv[]) writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilterNew.cxx b/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilterNew.cxx index f1ef77ca2a..bcf1fe8481 100644 --- a/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilterNew.cxx @@ -23,13 +23,12 @@ int otbImageToHessianDeterminantImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageToHessianDeterminantImageFilter<ImageType,ImageType> FilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageToHessianDeterminantImageFilter<ImageType, ImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbImageToLineSegmentVectorData.cxx b/Testing/Code/FeatureExtraction/otbImageToLineSegmentVectorData.cxx index 53022aa85a..52a71eb8e5 100644 --- a/Testing/Code/FeatureExtraction/otbImageToLineSegmentVectorData.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToLineSegmentVectorData.cxx @@ -22,35 +22,33 @@ #include "otbVectorDataFileWriter.h" #include "otbStreamingImageFileWriter.h" -int otbImageToLineSegmentVectorData( int argc, char * argv[] ) +int otbImageToLineSegmentVectorData(int argc, char * argv[]) { - - typedef float InputPixelType; - const unsigned int Dimension = 2; - + + typedef float InputPixelType; + const unsigned int Dimension = 2; + /** Typedefs */ - typedef otb::Image< InputPixelType, Dimension > ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - + typedef otb::Image<InputPixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageToLineSegmentVectorData<ImageType> ImToLSDFilterType; typedef ImToLSDFilterType::VectorDataType VectorDataType; typedef otb::VectorDataFileWriter<VectorDataType> WriterType; - ImToLSDFilterType::Pointer lsdFilter = ImToLSDFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ImToLSDFilterType::Pointer lsdFilter = ImToLSDFilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(argv[1]); reader->GenerateOutputInformation(); - lsdFilter->SetInput( reader->GetOutput() ); - lsdFilter->SetThreadDistanceThreshold( 10. ); + lsdFilter->SetInput(reader->GetOutput()); + lsdFilter->SetThreadDistanceThreshold(10.); lsdFilter->Update(); writer->SetFileName(argv[2]); - writer->SetInput( lsdFilter->GetOutputVectorData() ); + writer->SetInput(lsdFilter->GetOutputVectorData()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbImageToLineSegmentVectorDataNew.cxx b/Testing/Code/FeatureExtraction/otbImageToLineSegmentVectorDataNew.cxx index 0672322860..c2db3f2254 100644 --- a/Testing/Code/FeatureExtraction/otbImageToLineSegmentVectorDataNew.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToLineSegmentVectorDataNew.cxx @@ -19,20 +19,17 @@ #include "otbImage.h" #include "otbImageToLineSegmentVectorData.h" - -int otbImageToLineSegmentVectorDataNew( int argc, char * argv[] ) +int otbImageToLineSegmentVectorDataNew(int argc, char * argv[]) { - - typedef float InputPixelType; - const unsigned int Dimension = 2; - + + typedef float InputPixelType; + const unsigned int Dimension = 2; + /** Typedefs */ - typedef otb::Image< InputPixelType, Dimension > ImageType; + typedef otb::Image<InputPixelType, Dimension> ImageType; typedef otb::ImageToLineSegmentVectorData<ImageType> PersistentLSDFilterType; - - PersistentLSDFilterType::Pointer lsdFilter = PersistentLSDFilterType::New(); - + PersistentLSDFilterType::Pointer lsdFilter = PersistentLSDFilterType::New(); + return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx index 68154a444c..fa29c2530d 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx @@ -36,20 +36,20 @@ #include "otbImageFileWriter.h" typedef itk::VariableLengthVector<float> RealVectorType; -typedef itk::PointSet<RealVectorType,2> PointSetType; -typedef otb::Image<float,2> ImageType; -typedef otb::Image<unsigned char, 2> OutputImageType; +typedef itk::PointSet<RealVectorType, 2> PointSetType; +typedef otb::Image<float, 2> ImageType; +typedef otb::Image<unsigned char, 2> OutputImageType; // PointSet iterator types -typedef PointSetType::PointsContainer PointsContainerType; -typedef PointsContainerType::Iterator PointsIteratorType; +typedef PointSetType::PointsContainer PointsContainerType; +typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; // Filter -typedef otb::ImageFileReader<ImageType> ReaderType; +typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; -typedef otb::ImageFileWriter<ImageType> WriterInputType; +typedef otb::ImageFileWriter<ImageType> WriterInputType; OutputImageType::Pointer sift(ImageType::Pointer input, const unsigned int octaves, @@ -58,10 +58,10 @@ OutputImageType::Pointer sift(ImageType::Pointer input, const float ratio, const char* siftFileName) { - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> SiftFilterType; - typedef itk::PointSetToImageFilter<PointSetType, OutputImageType> PointSetFilterType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> SiftFilterType; + typedef itk::PointSetToImageFilter<PointSetType, OutputImageType> PointSetFilterType; - SiftFilterType::Pointer sift = SiftFilterType::New(); + SiftFilterType::Pointer sift = SiftFilterType::New(); PointSetFilterType::Pointer pointSetFilter = PointSetFilterType::New(); sift->SetInput(input); @@ -86,8 +86,8 @@ OutputImageType::Pointer sift(ImageType::Pointer input, return pointSetFilter->GetOutput(); } -OutputImageType::Pointer ddm( OutputImageType::Pointer input, - const char* ddmFileName) +OutputImageType::Pointer ddm(OutputImageType::Pointer input, + const char* ddmFileName) { typedef itk::DanielssonDistanceMapImageFilter <OutputImageType, OutputImageType> DDMFilterType; DDMFilterType::Pointer ddmFilter = DDMFilterType::New(); @@ -104,21 +104,21 @@ OutputImageType::Pointer ddm( OutputImageType::Pointer input, return ddmFilter->GetOutput(); } -ImageType::Pointer rotate( ImageType::Pointer input, - const unsigned int rotation) +ImageType::Pointer rotate(ImageType::Pointer input, + const unsigned int rotation) { typedef itk::AffineTransform<double, 2> TransformType; typedef itk::ResampleImageFilter<ImageType, ImageType> ResampleFilterType; ResampleFilterType::Pointer resampler = ResampleFilterType::New(); - TransformType::Pointer transform = TransformType::New(); + TransformType::Pointer transform = TransformType::New(); TransformType::OutputVectorType translation1; TransformType::OutputVectorType translation2; const ImageType::SpacingType& spacing = input->GetSpacing(); - const ImageType::PointType& origin = input->GetOrigin(); - ImageType::SizeType size = input->GetLargestPossibleRegion().GetSize(); + const ImageType::PointType& origin = input->GetOrigin(); + ImageType::SizeType size = input->GetLargestPossibleRegion().GetSize(); const double imageCenterX = origin[0] + spacing[0] * size[0] / 2.0; const double imageCenterY = origin[1] + spacing[1] * size[1] / 2.0; @@ -130,13 +130,13 @@ ImageType::Pointer rotate( ImageType::Pointer input, translation2[0] = imageCenterX; translation2[1] = imageCenterY; - transform->Translate( translation1 ); - transform->Rotate2D( -angle, false ); - transform->Translate( translation2 ); + transform->Translate(translation1); + transform->Rotate2D(-angle, false); + transform->Translate(translation2); - resampler->SetOutputOrigin( origin ); - resampler->SetOutputSpacing( spacing ); - resampler->SetSize( size ); + resampler->SetOutputOrigin(origin); + resampler->SetOutputSpacing(spacing); + resampler->SetSize(size); resampler->SetTransform(transform); resampler->SetInput(input); resampler->Update(); @@ -151,13 +151,13 @@ OutputImageType::Pointer invRotate(OutputImageType::Pointer input, ResampleFilterType; ResampleFilterType::Pointer resampler = ResampleFilterType::New(); - TransformType::Pointer transform = TransformType::New(); + TransformType::Pointer transform = TransformType::New(); TransformType::OutputVectorType translation1; TransformType::OutputVectorType translation2; const ImageType::SpacingType& spacing = input->GetSpacing(); - const ImageType::PointType& origin = input->GetOrigin(); - ImageType::SizeType size = input->GetLargestPossibleRegion().GetSize(); + const ImageType::PointType& origin = input->GetOrigin(); + ImageType::SizeType size = input->GetLargestPossibleRegion().GetSize(); const double imageCenterX = origin[0] + spacing[0] * size[0] / 2.0; const double imageCenterY = origin[1] + spacing[1] * size[1] / 2.0; @@ -170,21 +170,21 @@ OutputImageType::Pointer invRotate(OutputImageType::Pointer input, translation2[0] = imageCenterX; translation2[1] = imageCenterY; - transform->Translate( translation1 ); - transform->Rotate2D( angle, false ); - transform->Translate( translation2 ); + transform->Translate(translation1); + transform->Rotate2D(angle, false); + transform->Translate(translation2); - resampler->SetOutputOrigin( origin ); - resampler->SetOutputSpacing( spacing ); - resampler->SetSize( size ); + resampler->SetOutputOrigin(origin); + resampler->SetOutputSpacing(spacing); + resampler->SetSize(size); resampler->SetTransform(transform); resampler->SetInput(input); resampler->Update(); return resampler->GetOutput(); } -ImageType::Pointer zoom( ImageType::Pointer input, - const unsigned int zoomFactor) +ImageType::Pointer zoom(ImageType::Pointer input, + const unsigned int zoomFactor) { typedef itk::ShrinkImageFilter<ImageType, ImageType> ShrinkFilterType; ShrinkFilterType::Pointer shrink = ShrinkFilterType::New(); @@ -196,8 +196,8 @@ ImageType::Pointer zoom( ImageType::Pointer input, return shrink->GetOutput(); } -OutputImageType::Pointer invZoom( OutputImageType::Pointer input, - const unsigned int zoomFactor) +OutputImageType::Pointer invZoom(OutputImageType::Pointer input, + const unsigned int zoomFactor) { typedef itk::ExpandImageFilter<OutputImageType, OutputImageType> ExpandFilterType; ExpandFilterType::Pointer expand = ExpandFilterType::New(); @@ -214,7 +214,7 @@ ImageType::Pointer contrast(ImageType::Pointer input, const unsigned int contrastMax) { typedef itk::RescaleIntensityImageFilter<ImageType, ImageType> RescaleFilterType; - RescaleFilterType::Pointer rescaler= RescaleFilterType::New(); + RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); rescaler->SetInput(input); rescaler->SetOutputMinimum(static_cast<RescaleFilterType::OutputPixelType>(contrastMin)); @@ -223,9 +223,9 @@ ImageType::Pointer contrast(ImageType::Pointer input, return rescaler->GetOutput(); } -OutputImageType::Pointer invContrast( OutputImageType::Pointer input, - const unsigned int contrastMin, - const unsigned int contrastMax) +OutputImageType::Pointer invContrast(OutputImageType::Pointer input, + const unsigned int contrastMin, + const unsigned int contrastMax) { return input; } @@ -235,10 +235,10 @@ void subtract(OutputImageType::Pointer image1, const char* subtractFileName) { typedef itk::SubtractImageFilter<OutputImageType, OutputImageType, ImageType> SubtractFilterType; - typedef itk::MinimumMaximumImageCalculator<ImageType> MaximumCalculatorType; - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> OutputRescaleFilterType; + typedef itk::MinimumMaximumImageCalculator<ImageType> MaximumCalculatorType; + typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> OutputRescaleFilterType; - SubtractFilterType::Pointer subtract = SubtractFilterType::New(); + SubtractFilterType::Pointer subtract = SubtractFilterType::New(); MaximumCalculatorType::Pointer maximumCalculator = MaximumCalculatorType::New(); subtract->SetInput1(image1); @@ -265,19 +265,19 @@ void subtract(OutputImageType::Pointer image1, int otbImageToSIFTKeyPointSetFilterDistanceMap(int argc, char * argv[]) { - if (argc < 9 ){ + if (argc < 9) + { std::cout << "Missing arguments " << std::endl; return EXIT_FAILURE; - } - + } // Input Image file name const char * infname = argv[1]; const unsigned int octaves = atoi(argv[2]); const unsigned int scales = atoi(argv[3]); - const float threshold = atof(argv[4]); - const float ratio = atof(argv[5]); + const float threshold = atof(argv[4]); + const float ratio = atof(argv[5]); // Rotation angle [0,360[ const unsigned int rotation = atoi(argv[6]); diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterNew.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterNew.cxx index a6ee560bc5..59ac7783d5 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterNew.cxx @@ -23,12 +23,12 @@ int otbImageToSIFTKeyPointSetFilterNew(int argc, char * argv[]) { typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> ImageToSIFTKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> ImageToSIFTKeyPointSetFilterType; // Instantiating object ImageToSIFTKeyPointSetFilterType::Pointer object = ImageToSIFTKeyPointSetFilterType::New(); diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx index 32c7ab2960..afb887748a 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx @@ -34,26 +34,26 @@ int otbImageToSIFTKeyPointSetFilterOutputAscii(int argc, char * argv[]) const unsigned int octaves = atoi(argv[3]); const unsigned int scales = atoi(argv[4]); - const float threshold = atof(argv[5]); - const float ratio = atof(argv[6]); + const float threshold = atof(argv[5]); + const float ratio = atof(argv[6]); typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> ImageToSIFTKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> ImageToSIFTKeyPointSetFilterType; // PointSet iterator types - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImageToSIFTKeyPointSetFilterType::Pointer filter = ImageToSIFTKeyPointSetFilterType::New(); reader->SetFileName(infname); @@ -66,31 +66,32 @@ int otbImageToSIFTKeyPointSetFilterOutputAscii(int argc, char * argv[]) PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); if (filter->GetOutput()->GetPointData() == NULL) - { + { std::cerr << "No sift point found!" << std::endl; - return EXIT_FAILURE;//Avoid the subsequent segfault, but need to check if that what the test want to do - } + return EXIT_FAILURE; //Avoid the subsequent segfault, but need to check if that what the test want to do + } PointDataIteratorType pDataIt = filter->GetOutput()->GetPointData()->Begin(); std::ofstream outfile(outfname); - outfile << "Number of octaves: "<<octaves << std::endl; - outfile << "Number of scales: "<<scales << std::endl; + outfile << "Number of octaves: " << octaves << std::endl; + outfile << "Number of scales: " << scales << std::endl; outfile << "Number of SIFT key points: " << filter->GetOutput()->GetNumberOfPoints() << std::endl; - while ( pIt!=filter->GetOutput()->GetPoints()->End() ) - { - outfile << "[" << std::fixed << std::setprecision(2) << pIt.Value()[0] << ", " << std::setprecision(2) << pIt.Value()[1] << "]["; + while (pIt != filter->GetOutput()->GetPoints()->End()) + { + outfile << "[" << std::fixed << std::setprecision(2) << pIt.Value()[0] << ", " << std::setprecision(2) << + pIt.Value()[1] << "]["; - unsigned int lIterDesc=0; + unsigned int lIterDesc = 0; while (lIterDesc < pDataIt.Value().Size()) - { + { outfile << std::setprecision(3) << pDataIt.Value()[lIterDesc] << " "; lIterDesc++; - } + } outfile << "]" << std::endl; ++pIt; ++pDataIt; - } + } outfile.close(); diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii.cxx index cdecd470e8..7c187935ff 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii.cxx @@ -34,26 +34,26 @@ int otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii(int argc, char * argv[] const unsigned int octaves = atoi(argv[3]); const unsigned int scales = atoi(argv[4]); - const float threshold = atof(argv[5]); - const float ratio = atof(argv[6]); + const float threshold = atof(argv[5]); + const float ratio = atof(argv[6]); typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> ImageToSIFTKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> ImageToSIFTKeyPointSetFilterType; // PointSet iterator types - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImageToSIFTKeyPointSetFilterType::Pointer filter = ImageToSIFTKeyPointSetFilterType::New(); reader->SetFileName(infname); @@ -64,27 +64,27 @@ int otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii(int argc, char * argv[] filter->SetEdgeThreshold(ratio); filter->Update(); - PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); + PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); PointDataIteratorType pDataIt = filter->GetOutput()->GetPointData()->Begin(); std::ofstream outfile(outfname); - outfile << "Number of octaves: "<<octaves << std::endl; - outfile << "Number of scales: "<<scales << std::endl; + outfile << "Number of octaves: " << octaves << std::endl; + outfile << "Number of scales: " << scales << std::endl; outfile << "Number of SIFT key points: " << filter->GetOutput()->GetNumberOfPoints() << std::endl; - while ( pIt!=filter->GetOutput()->GetPoints()->End() ) - { + while (pIt != filter->GetOutput()->GetPoints()->End()) + { outfile << "["; - unsigned int lIterDesc=0; + unsigned int lIterDesc = 0; while (lIterDesc < pDataIt.Value().Size()) - { + { outfile << std::setprecision(3) << pDataIt.Value()[lIterDesc] << " "; lIterDesc++; - } + } outfile << "]" << std::endl; ++pIt; ++pDataIt; - } + } outfile.close(); diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx index 36e356c6c5..43c1fcc412 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx @@ -39,20 +39,20 @@ int otbImageToSIFTKeyPointSetFilterOutputImage(int argc, char * argv[]) float ratio = atof(argv[6]); typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> ImageToSIFTKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> ImageToSIFTKeyPointSetFilterType; // PointSet iterator types typedef PointSetType::PointsContainer PointsContainerType; typedef PointsContainerType::Iterator PointsIteratorType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImageToSIFTKeyPointSetFilterType::Pointer filter = ImageToSIFTKeyPointSetFilterType::New(); reader->SetFileName(infname); @@ -65,18 +65,18 @@ int otbImageToSIFTKeyPointSetFilterOutputImage(int argc, char * argv[]) filter->Update(); ImageType::OffsetType t = {{ 0, 1}}; - ImageType::OffsetType b = {{ 0,-1}}; + ImageType::OffsetType b = {{ 0, -1}}; ImageType::OffsetType l = {{ 1, 0}}; ImageType::OffsetType r = {{-1, 0}}; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,2> UCharImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, 2> UCharImageType; - typedef itk::RGBPixel<PixelType> RGBPixelType; + typedef itk::RGBPixel<PixelType> RGBPixelType; typedef otb::Image<RGBPixelType, 2> OutputImageType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - OutputImageType::Pointer outputImage = OutputImageType::New(); + OutputImageType::Pointer outputImage = OutputImageType::New(); OutputImageType::RegionType region; OutputImageType::SizeType outputSize; @@ -93,21 +93,21 @@ int otbImageToSIFTKeyPointSetFilterOutputImage(int argc, char * argv[]) outputImage->Allocate(); itk::ImageRegionIterator<OutputImageType> iterOutput(outputImage, - outputImage->GetLargestPossibleRegion()); + outputImage->GetLargestPossibleRegion()); itk::ImageRegionIterator<ImageType> iterInput(reader->GetOutput(), - reader->GetOutput()->GetLargestPossibleRegion()); + reader->GetOutput()->GetLargestPossibleRegion()); for (iterOutput.GoToBegin(), iterInput.GoToBegin(); !iterOutput.IsAtEnd(); ++iterOutput, ++iterInput) - { + { OutputImageType::PixelType rgbPixel; - rgbPixel.SetRed( static_cast<PixelType>(iterInput.Get()) ); - rgbPixel.SetGreen( static_cast<PixelType>(iterInput.Get()) ); - rgbPixel.SetBlue( static_cast<PixelType>(iterInput.Get()) ); + rgbPixel.SetRed(static_cast<PixelType>(iterInput.Get())); + rgbPixel.SetGreen(static_cast<PixelType>(iterInput.Get())); + rgbPixel.SetBlue(static_cast<PixelType>(iterInput.Get())); iterOutput.Set(rgbPixel); - } + } WriterType::Pointer writerTmp = WriterType::New(); writerTmp->SetFileName(outputImageFilename); @@ -116,22 +116,22 @@ int otbImageToSIFTKeyPointSetFilterOutputImage(int argc, char * argv[]) std::cout << "Copy Input image in Output image" << std::endl; - PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); - ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); - ImageType::PointType origin = reader->GetOutput()->GetOrigin(); + PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); + ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); + ImageType::PointType origin = reader->GetOutput()->GetOrigin(); OutputImageType::SizeType size = outputImage->GetLargestPossibleRegion().GetSize(); - while ( pIt != filter->GetOutput()->GetPoints()->End() ) - { + while (pIt != filter->GetOutput()->GetPoints()->End()) + { ImageType::IndexType index; index[0] = (unsigned int) (vcl_floor - ((double)((pIt.Value()[0]-origin[0])/spacing[0]+0.5))); + ((double) ((pIt.Value()[0] - origin[0]) / spacing[0] + 0.5))); index[1] = (unsigned int) (vcl_floor - ((double)((pIt.Value()[1]-origin[1])/spacing[1]+0.5))); + ((double) ((pIt.Value()[1] - origin[1]) / spacing[1] + 0.5))); OutputImageType::PixelType keyPixel; keyPixel.SetRed(0); @@ -139,23 +139,19 @@ int otbImageToSIFTKeyPointSetFilterOutputImage(int argc, char * argv[]) keyPixel.SetBlue(0); if (outputImage->GetLargestPossibleRegion().IsInside(index)) - { - outputImage->SetPixel(index,keyPixel); + { + outputImage->SetPixel(index, keyPixel); - if (outputImage->GetLargestPossibleRegion().IsInside(index+t)) - outputImage->SetPixel(index+t,keyPixel); + if (outputImage->GetLargestPossibleRegion().IsInside(index + t)) outputImage->SetPixel(index + t, keyPixel); - if (outputImage->GetLargestPossibleRegion().IsInside(index+b)) - outputImage->SetPixel(index+b,keyPixel); + if (outputImage->GetLargestPossibleRegion().IsInside(index + b)) outputImage->SetPixel(index + b, keyPixel); - if (outputImage->GetLargestPossibleRegion().IsInside(index+l)) - outputImage->SetPixel(index+l,keyPixel); + if (outputImage->GetLargestPossibleRegion().IsInside(index + l)) outputImage->SetPixel(index + l, keyPixel); - if (outputImage->GetLargestPossibleRegion().IsInside(index+r)) - outputImage->SetPixel(index+r,keyPixel); - } + if (outputImage->GetLargestPossibleRegion().IsInside(index + r)) outputImage->SetPixel(index + r, keyPixel); + } ++pIt; - } + } std::cout << "Copy sift key" << std::endl; diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii.cxx index d2bddeadc8..32c8e3448f 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii.cxx @@ -34,26 +34,26 @@ int otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii(int argc, char * arg const unsigned int octaves = atoi(argv[3]); const unsigned int scales = atoi(argv[4]); - const float threshold = atof(argv[5]); - const float ratio = atof(argv[6]); + const float threshold = atof(argv[5]); + const float ratio = atof(argv[6]); typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> ImageToSIFTKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> ImageToSIFTKeyPointSetFilterType; // PointSet iterator types - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImageToSIFTKeyPointSetFilterType::Pointer filter = ImageToSIFTKeyPointSetFilterType::New(); reader->SetFileName(infname); @@ -68,15 +68,16 @@ int otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii(int argc, char * arg std::ofstream outfile(outfname); - outfile << "Number of octaves: "<<octaves << std::endl; - outfile << "Number of scales: "<<scales << std::endl; + outfile << "Number of octaves: " << octaves << std::endl; + outfile << "Number of scales: " << scales << std::endl; outfile << "Number of SIFT key points: " << filter->GetOutput()->GetNumberOfPoints() << std::endl; - while ( pIt!=filter->GetOutput()->GetPoints()->End() ) - { - outfile << "[" << std::fixed << std::setprecision(2) << pIt.Value()[0] << ", " << std::setprecision(2) << pIt.Value()[1] << "]" << std::endl; + while (pIt != filter->GetOutput()->GetPoints()->End()) + { + outfile << "[" << std::fixed << std::setprecision(2) << pIt.Value()[0] << ", " << std::setprecision(2) << + pIt.Value()[1] << "]" << std::endl; ++pIt; - } + } outfile.close(); diff --git a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterNew.cxx b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterNew.cxx index e1e8342656..fe9f700452 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterNew.cxx @@ -22,20 +22,18 @@ #include "itkPointSet.h" #include "itkVariableLengthVector.h" - int otbImageToSURFKeyPointSetFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::VariableLengthVector<PixelType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSURFKeyPointSetFilter<ImageType,PointSetType> FilterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::VariableLengthVector<PixelType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSURFKeyPointSetFilter<ImageType, PointSetType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputDescriptorAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputDescriptorAscii.cxx index 53d94003e7..2720eaa1df 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputDescriptorAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputDescriptorAscii.cxx @@ -32,11 +32,11 @@ int otbImageToSURFKeyPointSetFilterOutputDescriptorAscii(int argc, char * argv[]) { - if (argc < 5 ) - { + if (argc < 5) + { std::cout << " Usage : otbSURFTest imageName FileOutName Octave[int] Level[int]" << std::endl; return EXIT_FAILURE; - } + } const char * infname = argv[1]; const char * outfname = argv[2]; @@ -44,24 +44,23 @@ int otbImageToSURFKeyPointSetFilterOutputDescriptorAscii(int argc, char * argv[] const unsigned int octaves = atoi(argv[3]); const unsigned int scales = atoi(argv[4]); - typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSURFKeyPointSetFilter<ImageType,PointSetType> ImageToSURFKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSURFKeyPointSetFilter<ImageType, PointSetType> ImageToSURFKeyPointSetFilterType; // PointSet iterator types - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImageToSURFKeyPointSetFilterType::Pointer filter = ImageToSURFKeyPointSetFilterType::New(); reader->SetFileName(infname); @@ -70,28 +69,28 @@ int otbImageToSURFKeyPointSetFilterOutputDescriptorAscii(int argc, char * argv[] filter->SetScalesNumber(scales); filter->Update(); - PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); + PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); PointDataIteratorType pDataIt = filter->GetOutput()->GetPointData()->Begin(); std::ofstream outfile(outfname); - outfile << "Number of octaves: "<<octaves << std::endl; - outfile << "Number of scales: "<<scales << std::endl; + outfile << "Number of octaves: " << octaves << std::endl; + outfile << "Number of scales: " << scales << std::endl; outfile << "Number of SURF key points: " << filter->GetNumberOfPoints() << std::endl; - while ( pIt!=filter->GetOutput()->GetPoints()->End() ) - { + while (pIt != filter->GetOutput()->GetPoints()->End()) + { outfile << "["; - unsigned int lIterDesc=0; + unsigned int lIterDesc = 0; while (lIterDesc < pDataIt.Value().Size()) - { - outfile <<std::setprecision(3) << pDataIt.Value()[lIterDesc] << " "; + { + outfile << std::setprecision(3) << pDataIt.Value()[lIterDesc] << " "; lIterDesc++; - } + } outfile << "]" << std::endl; ++pIt; ++pDataIt; - } + } outfile.close(); diff --git a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputInterestPointAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputInterestPointAscii.cxx index 4d97f09b41..c5c7586bb2 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputInterestPointAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputInterestPointAscii.cxx @@ -32,11 +32,11 @@ int otbImageToSURFKeyPointSetFilterOutputInterestPointAscii(int argc, char * argv[]) { - if (argc < 5 ) - { + if (argc < 5) + { std::cout << " Usage : otbSURFTest imageName FileOutName Octave[int] Level[int]" << std::endl; return EXIT_FAILURE; - } + } const char * infname = argv[1]; const char * outfname = argv[2]; @@ -44,24 +44,23 @@ int otbImageToSURFKeyPointSetFilterOutputInterestPointAscii(int argc, char * arg const unsigned int octaves = atoi(argv[3]); const unsigned int scales = atoi(argv[4]); - typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef otb::Image<RealType,Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef otb::ImageToSURFKeyPointSetFilter<ImageType,PointSetType> ImageToSURFKeyPointSetFilterType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef otb::ImageToSURFKeyPointSetFilter<ImageType, PointSetType> ImageToSURFKeyPointSetFilterType; // PointSet iterator types - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ImageToSURFKeyPointSetFilterType::Pointer filter = ImageToSURFKeyPointSetFilterType::New(); reader->SetFileName(infname); @@ -70,20 +69,21 @@ int otbImageToSURFKeyPointSetFilterOutputInterestPointAscii(int argc, char * arg filter->SetScalesNumber(scales); filter->Update(); - PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); + PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); PointDataIteratorType pDataIt = filter->GetOutput()->GetPointData()->Begin(); std::ofstream outfile(outfname); - outfile << "Number of octaves: "<<octaves << std::endl; - outfile << "Number of scales: "<<scales << std::endl; + outfile << "Number of octaves: " << octaves << std::endl; + outfile << "Number of scales: " << scales << std::endl; outfile << "Number of SURF key points: " << filter->GetNumberOfPoints() << std::endl; - while ( pIt!=filter->GetOutput()->GetPoints()->End() ) - { - outfile << "[" << std::fixed << std::setprecision(2) << pIt.Value()[0] << ", " << std::setprecision(2) << pIt.Value()[1] << "]" << std::endl; + while (pIt != filter->GetOutput()->GetPoints()->End()) + { + outfile << "[" << std::fixed << std::setprecision(2) << pIt.Value()[0] << ", " << std::setprecision(2) << + pIt.Value()[1] << "]" << std::endl; ++pIt; - } + } outfile.close(); diff --git a/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilter.cxx b/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilter.cxx index 201a6e2e9f..a9f426153a 100644 --- a/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilter.cxx @@ -32,14 +32,13 @@ int otbKeyPointSetsMatchingFilter(int argc, char* argv[]) const char * outfname = argv[1]; const double thresh = atof(argv[2]); - const bool useBackMatching = atoi(argv[3]); + const bool useBackMatching = atoi(argv[3]); - typedef itk::VariableLengthVector<double> PointDataType; - typedef itk::PointSet<PointDataType,2> PointSetType; - typedef PointSetType::PointType PointType; + typedef itk::VariableLengthVector<double> PointDataType; + typedef itk::PointSet<PointDataType, 2> PointSetType; + typedef PointSetType::PointType PointType; typedef otb::KeyPointSetsMatchingFilter<PointSetType> MatchingFilterType; - typedef MatchingFilterType::LandmarkListType LandmarkListType; - + typedef MatchingFilterType::LandmarkListType LandmarkListType; // instantiation MatchingFilterType::Pointer filter = MatchingFilterType::New(); @@ -51,40 +50,40 @@ int otbKeyPointSetsMatchingFilter(int argc, char* argv[]) PointSetType::Pointer ps1 = PointSetType::New(); PointSetType::Pointer ps2 = PointSetType::New(); - PointType p1,p2,p3; + PointType p1, p2, p3; p1.Fill(1); p2.Fill(2); p3.Fill(3); - PointDataType d1(3),d2(3),d3(3),d1b(3),d2b(3),d3b(3); + PointDataType d1(3), d2(3), d3(3), d1b(3), d2b(3), d3b(3); d1.Fill(1); d1b.Fill(1); d2.Fill(0); - d2[0]=10; + d2[0] = 10; d2b.Fill(0); - d2b[1]=10; + d2b[1] = 10; d3.Fill(2); d3b.Fill(10); - ps1->SetPoint(0,p1); - ps1->SetPoint(1,p2); - ps1->SetPoint(2,p3); + ps1->SetPoint(0, p1); + ps1->SetPoint(1, p2); + ps1->SetPoint(2, p3); - ps2->SetPoint(0,p1); - ps2->SetPoint(1,p2); - ps2->SetPoint(2,p3); + ps2->SetPoint(0, p1); + ps2->SetPoint(1, p2); + ps2->SetPoint(2, p3); - ps1->SetPointData(0,d1); - ps1->SetPointData(1,d2); - ps1->SetPointData(2,d3); + ps1->SetPointData(0, d1); + ps1->SetPointData(1, d2); + ps1->SetPointData(2, d3); - ps2->SetPointData(0,d1b); - ps2->SetPointData(1,d2b); - ps2->SetPointData(2,d3b); + ps2->SetPointData(0, d1b); + ps2->SetPointData(1, d2b); + ps2->SetPointData(2, d3b); filter->SetInput1(ps1); filter->SetInput2(ps2); @@ -94,12 +93,13 @@ int otbKeyPointSetsMatchingFilter(int argc, char* argv[]) LandmarkListType * matching = filter->GetOutput(); std::ofstream outfile(outfname); - outfile <<"Matches: "<<std::endl; + outfile << "Matches: " << std::endl; - for (LandmarkListType::Iterator it = matching->Begin(); it != matching->End();++it) - { - outfile<<"Matching: "<<it.Get()->GetPoint1()<< " " << it.Get()->GetPointData1()<< " <- "<<it.Get()->GetLandmarkData() << " -> "<<it.Get()->GetPoint2()<< " " << it.Get()->GetPointData2() << std::endl; - } + for (LandmarkListType::Iterator it = matching->Begin(); it != matching->End(); ++it) + { + outfile << "Matching: " << it.Get()->GetPoint1() << " " << it.Get()->GetPointData1() << " <- " << + it.Get()->GetLandmarkData() << " -> " << it.Get()->GetPoint2() << " " << it.Get()->GetPointData2() << std::endl; + } outfile.close(); diff --git a/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilterNew.cxx b/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilterNew.cxx index e39b256563..7cbee6afef 100644 --- a/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilterNew.cxx @@ -22,10 +22,10 @@ int otbKeyPointSetsMatchingFilterNew(int argc, char * argv[]) { typedef float RealType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; + typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; typedef otb::KeyPointSetsMatchingFilter<PointSetType> EuclideanDistanceMatchingFilterType; // Instantiating object diff --git a/Testing/Code/FeatureExtraction/otbLandmarkNew.cxx b/Testing/Code/FeatureExtraction/otbLandmarkNew.cxx index 8145e3fdd5..b565169e1e 100644 --- a/Testing/Code/FeatureExtraction/otbLandmarkNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLandmarkNew.cxx @@ -26,9 +26,9 @@ int otbLandmarkNew(int argc, char* argv[]) { - typedef itk::Point<double,2> PointType; - typedef itk::VariableLengthVector<double> PointDataType; - typedef otb::Landmark<PointType,PointDataType,double> LandmarkType; + typedef itk::Point<double, 2> PointType; + typedef itk::VariableLengthVector<double> PointDataType; + typedef otb::Landmark<PointType, PointDataType, double> LandmarkType; // instantiation LandmarkType::Pointer landmark = LandmarkType::New(); diff --git a/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilter.cxx index f046bd236b..171ea699f2 100644 --- a/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilter.cxx @@ -26,70 +26,69 @@ int otbLikelihoodPathListFilter(int argc, char * argv[]) { - std::cout<<std::endl; + std::cout << std::endl; const char * infname = argv[1]; const char * outfname = argv[2]; - typedef std::vector<double> PointsVectorType; - typedef std::vector< PointsVectorType > PointsMatrixType; + typedef std::vector<double> PointsVectorType; + typedef std::vector<PointsVectorType> PointsMatrixType; PointsMatrixType MatricePoints; PointsVectorType ListPoints; int cpt = 3; ListPoints.clear(); - while ( argv[cpt] != NULL ) - { - if ( argv[cpt][0] == '|' ) + while (argv[cpt] != NULL) { - if ( (ListPoints.size()%2) != 0 ) + if (argv[cpt][0] == '|') { - itkGenericExceptionMacro(<<"Missing point in parameters !"); - } + if ((ListPoints.size() % 2) != 0) + { + itkGenericExceptionMacro(<< "Missing point in parameters !"); + } MatricePoints.push_back(ListPoints); ListPoints.clear(); - } + } else - { + { ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } + } cpt++; - } + } MatricePoints.push_back(ListPoints); const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::PolyLineParametricPathWithValue<double,Dimension> PathType; - typedef otb::LikelihoodPathListFilter<PathType,ImageType> LikelihoodPathListFilterType; - typedef LikelihoodPathListFilterType::PathListType PathListType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::PolyLineParametricPathWithValue<double, Dimension> PathType; + typedef otb::LikelihoodPathListFilter<PathType, ImageType> LikelihoodPathListFilterType; + typedef LikelihoodPathListFilterType::PathListType PathListType; PathType::ContinuousIndexType cindex; - PathListType::Pointer InputPathList = PathListType::New(); //Generate PathList - for (PointsMatrixType::iterator listpos=MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { + for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) + { PathType::Pointer path = PathType::New(); //Generate PathList - std::cout << "List "<<std::endl; - for (PointsVectorType::iterator it=(*listpos).begin(); it != (*listpos).end(); ++it) - { + std::cout << "List " << std::endl; + for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) + { cindex[0] = *it; ++it; cindex[1] = *it; - std::cout << "Point Index :"<<cindex[0]<<";"<<cindex[1]<<std::endl; + std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; path->AddVertex(cindex); - } + } InputPathList->PushBack(path); - } + } //Instantiating object LikelihoodPathListFilterType::Pointer filter = LikelihoodPathListFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); reader->Update(); @@ -97,60 +96,59 @@ int otbLikelihoodPathListFilter(int argc, char * argv[]) filter->SetInputImage(reader->GetOutput()); filter->Update(); - std::cout<<"Filter execution ended"<<std::endl; + std::cout << "Filter execution ended" << std::endl; PathListType::Pointer OutputPathList = filter->GetOutput(); - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; + typedef PathListType::ConstIterator PathListIteratorType; + typedef PathType::VertexListType VertexListType; typedef VertexListType::ConstIterator VertexIteratorType; std::ofstream file; file.open(outfname); - unsigned int counter = 1; + unsigned int counter = 1; PathListIteratorType pathListIt = InputPathList->Begin(); - file<<"INPUT list of Path "<<": "<<std::endl; - while (pathListIt!=InputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "INPUT list of Path " << ": " << std::endl; + while (pathListIt != InputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } counter = 1; pathListIt = OutputPathList->Begin(); - file<<"OUTPUT list of Path "<<": "<<std::endl; - while (pathListIt!=OutputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "OUTPUT list of Path " << ": " << std::endl; + while (pathListIt != OutputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<< " Value: "<<pathListIt.Get()->GetValue(); - file<<std::endl; + file << " Value: " << pathListIt.Get()->GetValue(); + file << std::endl; ++pathListIt; ++counter; - } + } file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilterNew.cxx index 450f7f806d..a105427d95 100644 --- a/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilterNew.cxx @@ -23,15 +23,14 @@ int otbLikelihoodPathListFilterNew(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::PolyLineParametricPathWithValue<double,Dimension> PathType; - typedef otb::LikelihoodPathListFilter<PathType,ImageType> LinkPathListFilterType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::PolyLineParametricPathWithValue<double, Dimension> PathType; + typedef otb::LikelihoodPathListFilter<PathType, ImageType> LinkPathListFilterType; // Instantiating object LinkPathListFilterType::Pointer object = LinkPathListFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbLineCorrelationDetector.cxx b/Testing/Code/FeatureExtraction/otbLineCorrelationDetector.cxx index 1d8843346f..925ff4e9e4 100644 --- a/Testing/Code/FeatureExtraction/otbLineCorrelationDetector.cxx +++ b/Testing/Code/FeatureExtraction/otbLineCorrelationDetector.cxx @@ -29,47 +29,43 @@ #include "otbImageFileWriter.h" #include "otbLineCorrelationDetectorImageFilter.h" - -int otbLineCorrelationDetector( int argc, char* argv[] ) +int otbLineCorrelationDetector(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; // Largeur de la ligne � detecter = 2*WidthLine+1 - unsigned int WidthLine((unsigned int)::atoi(argv[3])); + unsigned int WidthLine((unsigned int) ::atoi(argv[3])); // Longueur de la ligne � detecter = 2*LengthLine+1 - unsigned int LengthLine((unsigned int)::atoi(argv[4])); + unsigned int LengthLine((unsigned int) ::atoi(argv[4])); - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::LineCorrelationDetectorImageFilter< InputImageType, OutputImageType > FilterType; + typedef otb::LineCorrelationDetectorImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer FilterLineCorrelation = FilterType::New(); - FilterLineCorrelation->SetWidthLine( WidthLine ); - FilterLineCorrelation->SetLengthLine( LengthLine ); + FilterLineCorrelation->SetWidthLine(WidthLine); + FilterLineCorrelation->SetLengthLine(LengthLine); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - FilterLineCorrelation->SetInput( reader->GetOutput() ); - writer->SetInput( FilterLineCorrelation->GetOutput() ); + FilterLineCorrelation->SetInput(reader->GetOutput()); + writer->SetInput(FilterLineCorrelation->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx b/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx index f192d530c9..f163d490b9 100644 --- a/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx +++ b/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx @@ -31,55 +31,52 @@ #include "itkLinearInterpolateImageFunction.h" -int otbLineCorrelationDetectorLinear( int argc, char* argv[] ) +int otbLineCorrelationDetectorLinear(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename1 = argv[2]; const char * outputFilename2 = argv[3]; // Largeur de la ligne � detecter = 2*WidthLine+1 - unsigned int WidthLine((unsigned int)::atoi(argv[4])); + unsigned int WidthLine((unsigned int) ::atoi(argv[4])); // Longueur de la ligne � detecter = 2*LengthLine+1 - unsigned int LengthLine((unsigned int)::atoi(argv[5])); + unsigned int LengthLine((unsigned int) ::atoi(argv[5])); - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageDirectionType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageDirectionType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType; - typedef otb::LineCorrelationDetectorImageFilter< InputImageType, OutputImageType, OutputImageDirectionType, InterpolatorType > FilterType; + typedef itk::LinearInterpolateImageFunction<InputImageType, + double> InterpolatorType; + typedef otb::LineCorrelationDetectorImageFilter<InputImageType, OutputImageType, OutputImageDirectionType, + InterpolatorType> FilterType; FilterType::Pointer FilterLineCorrelation = FilterType::New(); - FilterLineCorrelation->SetWidthLine( WidthLine ); - FilterLineCorrelation->SetLengthLine( LengthLine ); + FilterLineCorrelation->SetWidthLine(WidthLine); + FilterLineCorrelation->SetLengthLine(LengthLine); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer1 = WriterType::New(); WriterType::Pointer writer2 = WriterType::New(); - reader->SetFileName( inputFilename ); - writer1->SetFileName( outputFilename1 ); + reader->SetFileName(inputFilename); + writer1->SetFileName(outputFilename1); writer2->SetFileName(outputFilename2); - - FilterLineCorrelation->SetInput( reader->GetOutput() ); - writer1->SetInput( FilterLineCorrelation->GetOutput() ); - writer2->SetInput( FilterLineCorrelation->GetOutputDirection() ); - + FilterLineCorrelation->SetInput(reader->GetOutput()); + writer1->SetInput(FilterLineCorrelation->GetOutput()); + writer2->SetInput(FilterLineCorrelation->GetOutputDirection()); writer1->Update(); writer2->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorNew.cxx b/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorNew.cxx index b9845a6fae..07b15acf05 100644 --- a/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorNew.cxx @@ -25,22 +25,18 @@ #include "otbLineCorrelationDetectorImageFilter.h" - -int otbLineCorrelationDetectorNew( int argc, char* argv[] ) +int otbLineCorrelationDetectorNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::LineCorrelationDetectorImageFilter< InputImageType, OutputImageType> FilterType; + typedef otb::LineCorrelationDetectorImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer FilterLineCorr = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLineDetectorBaseNew.cxx b/Testing/Code/FeatureExtraction/otbLineDetectorBaseNew.cxx index 8fdc5102b0..e364a66773 100644 --- a/Testing/Code/FeatureExtraction/otbLineDetectorBaseNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLineDetectorBaseNew.cxx @@ -25,22 +25,18 @@ #include "otbLineDetectorImageFilterBase.h" - -int otbLineDetectorBaseNew( int argc, char* argv[] ) +int otbLineDetectorBaseNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::LineDetectorImageFilterBase< InputImageType, OutputImageType> FilterType; + typedef otb::LineDetectorImageFilterBase<InputImageType, OutputImageType> FilterType; FilterType::Pointer FilterLine = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLineRatioDetector.cxx b/Testing/Code/FeatureExtraction/otbLineRatioDetector.cxx index 79a6d63119..9269c232b4 100644 --- a/Testing/Code/FeatureExtraction/otbLineRatioDetector.cxx +++ b/Testing/Code/FeatureExtraction/otbLineRatioDetector.cxx @@ -29,46 +29,43 @@ #include "otbImageFileWriter.h" #include "otbLineRatioDetectorImageFilter.h" -int otbLineRatioDetector( int argc, char* argv[] ) +int otbLineRatioDetector(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; // Largeur de la ligne a detecter = 2*WidthLine+1 - unsigned int WidthLine((unsigned int)::atoi(argv[3])); + unsigned int WidthLine((unsigned int) ::atoi(argv[3])); // Longueur de la ligne a detecter = 2*LengthLine+1 - unsigned int LengthLine((unsigned int)::atoi(argv[4])); + unsigned int LengthLine((unsigned int) ::atoi(argv[4])); - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::LineRatioDetectorImageFilter< InputImageType, OutputImageType > FilterType; + typedef otb::LineRatioDetectorImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer FilterLineRatio = FilterType::New(); - FilterLineRatio->SetWidthLine( WidthLine ); - FilterLineRatio->SetLengthLine( LengthLine ); + FilterLineRatio->SetWidthLine(WidthLine); + FilterLineRatio->SetLengthLine(LengthLine); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - FilterLineRatio->SetInput( reader->GetOutput() ); - writer->SetInput( FilterLineRatio->GetOutput() ); + FilterLineRatio->SetInput(reader->GetOutput()); + writer->SetInput(FilterLineRatio->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx b/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx index 3b28f23830..d18f636fd4 100644 --- a/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx +++ b/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx @@ -31,54 +31,52 @@ #include "itkLinearInterpolateImageFunction.h" -int otbLineRatioDetectorLinear( int argc, char* argv[] ) +int otbLineRatioDetectorLinear(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename1 = argv[2]; const char * outputFilename2 = argv[3]; - // Width of the linear feature = 2*WidthLine+1 - unsigned int WidthLine((unsigned int)::atoi(argv[4])); + unsigned int WidthLine((unsigned int) ::atoi(argv[4])); // Length of the linear feature = 2*LengthLine+1 - unsigned int LengthLine((unsigned int)::atoi(argv[5])); + unsigned int LengthLine((unsigned int) ::atoi(argv[5])); - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageDirectionType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageDirectionType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType; - typedef otb::LineRatioDetectorImageFilter< InputImageType, OutputImageType, OutputImageDirectionType, InterpolatorType > FilterType; + typedef itk::LinearInterpolateImageFunction<InputImageType, + double> InterpolatorType; + typedef otb::LineRatioDetectorImageFilter<InputImageType, OutputImageType, OutputImageDirectionType, + InterpolatorType> FilterType; FilterType::Pointer FilterLineRatio = FilterType::New(); - FilterLineRatio->SetWidthLine( WidthLine ); - FilterLineRatio->SetLengthLine( LengthLine ); + FilterLineRatio->SetWidthLine(WidthLine); + FilterLineRatio->SetLengthLine(LengthLine); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer1 = WriterType::New(); WriterType::Pointer writer2 = WriterType::New(); - reader->SetFileName( inputFilename ); - writer1->SetFileName( outputFilename1 ); - writer2->SetFileName( outputFilename2 ); + reader->SetFileName(inputFilename); + writer1->SetFileName(outputFilename1); + writer2->SetFileName(outputFilename2); - FilterLineRatio->SetInput( reader->GetOutput() ); - writer1->SetInput( FilterLineRatio->GetOutput() ); - writer2->SetInput( FilterLineRatio->GetOutputDirection() ); + FilterLineRatio->SetInput(reader->GetOutput()); + writer1->SetInput(FilterLineRatio->GetOutput()); + writer2->SetInput(FilterLineRatio->GetOutputDirection()); writer1->Update(); writer2->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLineRatioDetectorNew.cxx b/Testing/Code/FeatureExtraction/otbLineRatioDetectorNew.cxx index aedab5207c..fcea73d21a 100644 --- a/Testing/Code/FeatureExtraction/otbLineRatioDetectorNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLineRatioDetectorNew.cxx @@ -26,22 +26,18 @@ #include "otbLineRatioDetectorImageFilter.h" - -int otbLineRatioDetectorNew( int argc, char* argv[] ) +int otbLineRatioDetectorNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::LineRatioDetectorImageFilter< InputImageType, OutputImageType> FilterType; + typedef otb::LineRatioDetectorImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer FilterLineRatio = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLineSegmentDetector.cxx b/Testing/Code/FeatureExtraction/otbLineSegmentDetector.cxx index b77a22845d..dca2f1ee54 100644 --- a/Testing/Code/FeatureExtraction/otbLineSegmentDetector.cxx +++ b/Testing/Code/FeatureExtraction/otbLineSegmentDetector.cxx @@ -25,29 +25,27 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLineSegmentDetector( int argc, char * argv[] ) +int otbLineSegmentDetector(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; - - typedef double InputPixelType; - const unsigned int Dimension = 2; - - /** Typedefs */ - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef InputImageType::IndexType IndexType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<InputImageType> WriterType; - typedef otb::DrawLineSpatialObjectListFilter< InputImageType ,InputImageType > DrawLineListType; - typedef otb::LineSegmentDetector<InputImageType , InputPixelType> lsdFilterType; - typedef itk::LineIterator<InputImageType> LineIteratorFilter; + const char * infname = argv[1]; + const char * outfname = argv[2]; + + typedef double InputPixelType; + const unsigned int Dimension = 2; + /** Typedefs */ + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef InputImageType::IndexType IndexType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<InputImageType> WriterType; + typedef otb::DrawLineSpatialObjectListFilter<InputImageType, InputImageType> DrawLineListType; + typedef otb::LineSegmentDetector<InputImageType, InputPixelType> lsdFilterType; + typedef itk::LineIterator<InputImageType> LineIteratorFilter; /** Instantiation of smart pointer*/ - lsdFilterType::Pointer lsdFilter = lsdFilterType::New(); + lsdFilterType::Pointer lsdFilter = lsdFilterType::New(); DrawLineListType::Pointer drawLineFilter = DrawLineListType::New(); - ReaderType::Pointer reader = ReaderType::New(); - + ReaderType::Pointer reader = ReaderType::New(); /** */ //typedef otb::LineSpatialObjectList LinesListType; @@ -67,19 +65,18 @@ int otbLineSegmentDetector( int argc, char * argv[] ) drawLineFilter->SetInput(reader->GetOutput()); drawLineFilter->SetInputLineSpatialObjectList(lsdFilter->GetOutput()); - // LinesListType::const_iterator it = lsdFilter->GetOutput()->begin(); // LinesListType::const_iterator itEnd = lsdFilter->GetOutput()->end(); - + // while(it != itEnd) // { // LineType::PointListType & pointsList = (*it)->GetPoints(); // LineType::PointListType::const_iterator itPoints = pointsList.begin(); - + // float x = (*itPoints).GetPosition()[0]; // float y = (*itPoints).GetPosition()[1]; // IndexBegin[0] = static_cast<int>(x); IndexBegin[1] = static_cast<int>(y); - + // itPoints++; // float x1 = (*itPoints).GetPosition()[0]; @@ -97,17 +94,13 @@ int otbLineSegmentDetector( int argc, char * argv[] ) // ++it; // } - - /** Write The Output Image*/ WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outfname); writer->SetInput(drawLineFilter->GetOutput()); writer->Update(); - std::cout << " lsdFilter Output Size" << lsdFilter->GetOutput()->size() <<std::endl; - - + std::cout << " lsdFilter Output Size" << lsdFilter->GetOutput()->size() << std::endl; + return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbLineSegmentDetectorNew.cxx b/Testing/Code/FeatureExtraction/otbLineSegmentDetectorNew.cxx index 688775e4f5..2e4fc3fbf9 100644 --- a/Testing/Code/FeatureExtraction/otbLineSegmentDetectorNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLineSegmentDetectorNew.cxx @@ -22,20 +22,17 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - -int otbLineSegmentDetectorNew( int argc, char * argv[] ) +int otbLineSegmentDetectorNew(int argc, char * argv[]) { - - typedef float InputPixelType; - const unsigned int Dimension = 2; - + + typedef float InputPixelType; + const unsigned int Dimension = 2; + /** Typedefs */ - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::LineSegmentDetector<InputImageType , InputPixelType> lsdFilterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::LineSegmentDetector<InputImageType, InputPixelType> lsdFilterType; + + lsdFilterType::Pointer lsdFilter = lsdFilterType::New(); - - lsdFilterType::Pointer lsdFilter = lsdFilterType::New(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.cxx b/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.cxx index 28a7da1dd9..0ead0b0429 100644 --- a/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.cxx @@ -21,41 +21,39 @@ #include "otbLineSpatialObjectListToRightAnglePointSetFilter.h" #include "otbLineSpatialObjectList.h" - #include "otbImageFileReader.h" #include <iostream> #include <fstream> -int otbLineSpatialObjectListToRightAnglePointSetFilter( int argc, char * argv[] ) +int otbLineSpatialObjectListToRightAnglePointSetFilter(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; - - const unsigned int Dimension = 2; - typedef float PixelType; - + const char * infname = argv[1]; + const char * outfname = argv[2]; + + const unsigned int Dimension = 2; + typedef float PixelType; + /** Typedefs */ - typedef otb::Image<PixelType ,Dimension > ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::LineSpatialObjectList LinesListType; - typedef LinesListType::LineType LineType; - typedef std::vector<LineType*> VectorLines; - typedef itk::PointSet<VectorLines , Dimension> PointSetType; - typedef otb::LineSpatialObjectListToRightAnglePointSetFilter<ImageType ,LinesListType, - PointSetType > RightAngleFilterType; - - /** Creatop, of an instance of the filters */ - RightAngleFilterType::Pointer rightAngleFilter = RightAngleFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - PointSetType::Pointer segmentOrtho = PointSetType::New(); + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::LineSpatialObjectList LinesListType; + typedef LinesListType::LineType LineType; + typedef std::vector<LineType*> VectorLines; + typedef itk::PointSet<VectorLines, Dimension> PointSetType; + typedef otb::LineSpatialObjectListToRightAnglePointSetFilter<ImageType, LinesListType, + PointSetType> RightAngleFilterType; + /** Creatop, of an instance of the filters */ + RightAngleFilterType::Pointer rightAngleFilter = RightAngleFilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + PointSetType::Pointer segmentOrtho = PointSetType::New(); /** Creation of lines */ - LinesListType::Pointer list = LinesListType::New(); + LinesListType::Pointer list = LinesListType::New(); LineType::PointListType pointList; LineType::LinePointType point; - + // Definition of the first line float Ux, Uy, Vx, Vy; Ux = 31.7; @@ -63,14 +61,14 @@ int otbLineSpatialObjectListToRightAnglePointSetFilter( int argc, char * argv[] Vx = 31.7; Vy = 25.1; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); LineType::Pointer line = LineType::New(); line->SetId(0); - line->SetPoints( pointList ); + line->SetPoints(pointList); line->ComputeBoundingBox(); list->push_back(line); @@ -83,15 +81,14 @@ int otbLineSpatialObjectListToRightAnglePointSetFilter( int argc, char * argv[] Vx = 30.1; Vy = 10.6; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); - LineType::Pointer line2 = LineType::New(); line2->SetId(0); - line2->SetPoints( pointList ); + line2->SetPoints(pointList); line2->ComputeBoundingBox(); list->push_back(line2); @@ -104,42 +101,39 @@ int otbLineSpatialObjectListToRightAnglePointSetFilter( int argc, char * argv[] Vx = 40.5; Vy = 17.1; - point.SetPosition(Ux,Uy); + point.SetPosition(Ux, Uy); pointList.push_back(point); - point.SetPosition(Vx,Vy); + point.SetPosition(Vx, Vy); pointList.push_back(point); LineType::Pointer line3 = LineType::New(); line3->SetId(0); - line3->SetPoints( pointList ); + line3->SetPoints(pointList); line3->ComputeBoundingBox(); list->push_back(line3); // Begin the process reader->SetFileName(infname); - + rightAngleFilter->SetInputImage(reader->GetOutput()); rightAngleFilter->SetInput(list); rightAngleFilter->Update(); /** Writing The result in the outfile*/ std::ofstream outfile(outfname); - outfile<< "Number of right angles detected " <<rightAngleFilter->GetOutput()->GetNumberOfPoints() <<std::endl; - + outfile << "Number of right angles detected " << rightAngleFilter->GetOutput()->GetNumberOfPoints() << std::endl; /** Draw the orthogonal segments */ segmentOrtho = rightAngleFilter->GetOutput(); - PointSetType::PointType pRight; - - for (unsigned int i = 0; i<segmentOrtho->GetNumberOfPoints(); i++) + PointSetType::PointType pRight; + + for (unsigned int i = 0; i < segmentOrtho->GetNumberOfPoints(); i++) { - segmentOrtho->GetPoint(i, &pRight); - outfile << " Right Angle found in point : " << pRight << std::endl; + segmentOrtho->GetPoint(i, &pRight); + outfile << " Right Angle found in point : " << pRight << std::endl; } outfile.close(); - - + return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii.cxx b/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii.cxx index 27c81639a1..7833c18469 100644 --- a/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii.cxx @@ -29,65 +29,60 @@ #include <iostream> #include <fstream> -int otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii( int argc, char * argv[] ) +int otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; - - const unsigned int Dimension = 2; - typedef float PixelType; - - /** Typedefs */ - typedef otb::Image<PixelType ,Dimension > ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::LineSpatialObjectList LinesListType; - typedef LinesListType::LineType LineType; - typedef std::vector<LineType*> VectorLines; - typedef itk::PointSet<VectorLines , Dimension> PointSetType; - typedef otb::LineSegmentDetector<ImageType , PixelType> lsdFilterType; - typedef otb::LineSpatialObjectListToRightAnglePointSetFilter<ImageType ,LinesListType, - PointSetType > RightAngleFilterType; - - /** Creatop, of an instance of the filters */ - RightAngleFilterType::Pointer rightAngleFilter = RightAngleFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - PointSetType::Pointer segmentOrtho = PointSetType::New(); - lsdFilterType::Pointer lsdFilter = lsdFilterType::New(); + const char * infname = argv[1]; + const char * outfname = argv[2]; + + const unsigned int Dimension = 2; + typedef float PixelType; + /** Typedefs */ + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::LineSpatialObjectList LinesListType; + typedef LinesListType::LineType LineType; + typedef std::vector<LineType*> VectorLines; + typedef itk::PointSet<VectorLines, Dimension> PointSetType; + typedef otb::LineSegmentDetector<ImageType, PixelType> lsdFilterType; + typedef otb::LineSpatialObjectListToRightAnglePointSetFilter<ImageType, LinesListType, + PointSetType> RightAngleFilterType; - + /** Creatop, of an instance of the filters */ + RightAngleFilterType::Pointer rightAngleFilter = RightAngleFilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + PointSetType::Pointer segmentOrtho = PointSetType::New(); + lsdFilterType::Pointer lsdFilter = lsdFilterType::New(); // Begin the process reader->SetFileName(infname); lsdFilter->SetInput(reader->GetOutput()); - + rightAngleFilter->SetInputImage(reader->GetOutput()); rightAngleFilter->SetInput(lsdFilter->GetOutput()); rightAngleFilter->Update(); - std::cout << "Number of right angles detected " <<rightAngleFilter->GetOutput()->GetNumberOfPoints() <<std::endl; - + std::cout << "Number of right angles detected " << rightAngleFilter->GetOutput()->GetNumberOfPoints() << std::endl; /** Print the right angles coordinate in the output file*/ segmentOrtho = rightAngleFilter->GetOutput(); - PointSetType::PointType pRight; - VectorLines outputVectorLines; - LinesListType::Pointer outputLinesList = LinesListType::New(); - + PointSetType::PointType pRight; + VectorLines outputVectorLines; + LinesListType::Pointer outputLinesList = LinesListType::New(); + std::ofstream outfile(outfname); - for (unsigned int i = 0; i<segmentOrtho->GetNumberOfPoints(); i++) + for (unsigned int i = 0; i < segmentOrtho->GetNumberOfPoints(); i++) { - segmentOrtho->GetPoint(i, &pRight); - outfile << " Right Angle found in point : " << pRight << std::endl; - - /** Exemple To extract The coordinate of the segment (Just for example)*/ - segmentOrtho->GetPointData(i, &outputVectorLines); - outputLinesList->push_back(outputVectorLines[0]); - outputLinesList->push_back(outputVectorLines[1]); + segmentOrtho->GetPoint(i, &pRight); + outfile << " Right Angle found in point : " << pRight << std::endl; + + /** Exemple To extract The coordinate of the segment (Just for example)*/ + segmentOrtho->GetPointData(i, &outputVectorLines); + outputLinesList->push_back(outputVectorLines[0]); + outputLinesList->push_back(outputVectorLines[1]); } outfile.close(); - + return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterNew.cxx b/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterNew.cxx index 968def4004..bdc813aeb8 100644 --- a/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterNew.cxx @@ -16,29 +16,26 @@ =========================================================================*/ - #include "otbLineSpatialObjectListToRightAnglePointSetFilter.h" #include "otbImage.h" #include "otbLineSpatialObjectList.h" #include "itkPointSet.h" -int otbLineSpatialObjectListToRightAnglePointSetFilterNew( int argc, char * argv[] ) +int otbLineSpatialObjectListToRightAnglePointSetFilterNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef float PixelType; - + const unsigned int Dimension = 2; + typedef float PixelType; + /** Typedefs */ - typedef otb::Image<PixelType ,Dimension > ImageType; - typedef otb::LineSpatialObjectList LinesListType; - typedef LinesListType::LineType LineType; - typedef std::vector<LineType *> VectorLines; - typedef itk::PointSet<VectorLines , Dimension> PointSetType; - typedef otb::LineSpatialObjectListToRightAnglePointSetFilter<ImageType ,LinesListType, - PointSetType > RightAngleFilterType; - - - RightAngleFilterType::Pointer rightAngleFilter = RightAngleFilterType::New(); - + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::LineSpatialObjectList LinesListType; + typedef LinesListType::LineType LineType; + typedef std::vector<LineType *> VectorLines; + typedef itk::PointSet<VectorLines, Dimension> PointSetType; + typedef otb::LineSpatialObjectListToRightAnglePointSetFilter<ImageType, LinesListType, + PointSetType> RightAngleFilterType; + + RightAngleFilterType::Pointer rightAngleFilter = RightAngleFilterType::New(); + return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx index 6ac8816a9c..c9d7abfa1f 100644 --- a/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx @@ -23,68 +23,66 @@ #include <fstream> #include <cstdlib> - int otbLinkPathListFilter(int argc, char * argv[]) { - std::cout<<std::endl; + std::cout << std::endl; const char * outfname = argv[1]; const double distance = atof(argv[2]); - const double angle = ::atof(argv[3])*otb::CONST_PI/180.; + const double angle = ::atof(argv[3]) * otb::CONST_PI / 180.; - typedef std::vector<double> PointsVectorType; - typedef std::vector< PointsVectorType > PointsMatrixType; + typedef std::vector<double> PointsVectorType; + typedef std::vector<PointsVectorType> PointsMatrixType; PointsMatrixType MatricePoints; PointsVectorType ListPoints; int cpt = 4; ListPoints.clear(); - while ( argv[cpt] != NULL ) - { - if ( argv[cpt][0] == '|' ) + while (argv[cpt] != NULL) { - if ( (ListPoints.size()%2) != 0 ) + if (argv[cpt][0] == '|') { - itkGenericExceptionMacro(<<"Missing point in parameters !"); - } + if ((ListPoints.size() % 2) != 0) + { + itkGenericExceptionMacro(<< "Missing point in parameters !"); + } MatricePoints.push_back(ListPoints); ListPoints.clear(); - } + } else - { + { ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } + } cpt++; - } + } MatricePoints.push_back(ListPoints); const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::LinkPathListFilter<PathType> LinkPathListFilterType; - typedef LinkPathListFilterType::PathListType PathListType; + typedef otb::LinkPathListFilter<PathType> LinkPathListFilterType; + typedef LinkPathListFilterType::PathListType PathListType; PathType::ContinuousIndexType cindex; - PathListType::Pointer InputPathList = PathListType::New(); //Generate PathList - for (PointsMatrixType::iterator listpos=MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { + for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) + { PathType::Pointer path = PathType::New(); //Generate PathList - std::cout << "List "<<std::endl; - for (PointsVectorType::iterator it=(*listpos).begin(); it != (*listpos).end(); ++it) - { + std::cout << "List " << std::endl; + for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) + { cindex[0] = *it; ++it; cindex[1] = *it; - std::cout << "Point Index :"<<cindex[0]<<";"<<cindex[1]<<std::endl; + std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; path->AddVertex(cindex); - } + } InputPathList->PushBack(path); - } + } //Instantiating object LinkPathListFilterType::Pointer filter = LinkPathListFilterType::New(); @@ -93,61 +91,61 @@ int otbLinkPathListFilter(int argc, char * argv[]) filter->SetAngularThreshold(angle); filter->Update(); - std::cout<<"Filter execution ended"<<std::endl; + std::cout << "Filter execution ended" << std::endl; PathListType::Pointer OutputPathList = filter->GetOutput(); - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; + typedef PathListType::ConstIterator PathListIteratorType; + typedef PathType::VertexListType VertexListType; typedef VertexListType::ConstIterator VertexIteratorType; std::ofstream file; file.open(outfname); - unsigned int counter = 1; + unsigned int counter = 1; PathListIteratorType pathListIt = InputPathList->Begin(); - file<<"Maximum distance threshold: "<<filter->GetDistanceThreshold()<< " ("<<distance<<")"<<std::endl; - file<<"Maximum angle threshold: "<<filter->GetAngularThreshold()<< " ("<<angle*180/otb::CONST_PI<<")"<<std::endl; - file<<"INPUT list of Path "<<": "<<std::endl; - while (pathListIt!=InputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "Maximum distance threshold: " << filter->GetDistanceThreshold() << " (" << distance << ")" << std::endl; + file << "Maximum angle threshold: " << filter->GetAngularThreshold() << " (" << angle * 180 / otb::CONST_PI << ")" << + std::endl; + file << "INPUT list of Path " << ": " << std::endl; + while (pathListIt != InputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } counter = 1; pathListIt = OutputPathList->Begin(); - file<<"OUTPUT list of Path "<<": "<<std::endl; - while (pathListIt!=OutputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "OUTPUT list of Path " << ": " << std::endl; + while (pathListIt != OutputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbLinkPathListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbLinkPathListFilterNew.cxx index e48e2a801a..897f944592 100644 --- a/Testing/Code/FeatureExtraction/otbLinkPathListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLinkPathListFilterNew.cxx @@ -24,11 +24,10 @@ int otbLinkPathListFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::LinkPathListFilter<PathType> LinkPathListFilterType; + typedef otb::LinkPathListFilter<PathType> LinkPathListFilterType; // Instantiating object LinkPathListFilterType::Pointer object = LinkPathListFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbLocalHough.cxx b/Testing/Code/FeatureExtraction/otbLocalHough.cxx index 04d21ae43f..4b68ccb359 100644 --- a/Testing/Code/FeatureExtraction/otbLocalHough.cxx +++ b/Testing/Code/FeatureExtraction/otbLocalHough.cxx @@ -22,7 +22,6 @@ #include "itkExceptionObject.h" - #include <iostream> #include "otbImage.h" @@ -34,42 +33,41 @@ #include <iostream> #include <fstream> - -int otbLocalHough( int argc, char* argv[] ) +int otbLocalHough(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outfname = argv[2]; - unsigned int RadiusX((unsigned int)::atoi(argv[3])); - unsigned int RadiusY((unsigned int)::atoi(argv[4])); - unsigned int NumberOfLines((unsigned int)::atoi(argv[5])); + unsigned int RadiusX((unsigned int) ::atoi(argv[3])); + unsigned int RadiusY((unsigned int) ::atoi(argv[4])); + unsigned int NumberOfLines((unsigned int) ::atoi(argv[5])); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::LocalHoughFilter< InputImageType > FilterType; + typedef otb::LocalHoughFilter<InputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->Update(); FilterType::SizeType Radius; Radius[0] = RadiusX; Radius[1] = RadiusY; - typedef otb::LineSpatialObjectList LinesListType; + typedef otb::LineSpatialObjectList LinesListType; LinesListType::Pointer list = LinesListType::New(); - filter->SetRadius( Radius ); - filter->SetNumberOfLines( NumberOfLines ); + filter->SetRadius(Radius); + filter->SetNumberOfLines(NumberOfLines); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); filter->Update(); list = filter->GetOutput(); @@ -77,15 +75,13 @@ int otbLocalHough( int argc, char* argv[] ) LinesListType::const_iterator itList; std::ofstream outfile(outfname); - outfile<< "size of the Line list " << list->size()<<std::endl; + outfile << "size of the Line list " << list->size() << std::endl; - for (itList=list->begin(); itList!=list->end(); itList++) - outfile << (*itList)->GetPoints()[0].GetPosition() << " \t" << (*itList)->GetPoints()[1].GetPosition() << std::endl; + for (itList = list->begin(); itList != list->end(); itList++) + outfile << (*itList)->GetPoints()[0].GetPosition() << " \t" << (*itList)->GetPoints()[1].GetPosition() << + std::endl; outfile.close(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLocalHoughDraw.cxx b/Testing/Code/FeatureExtraction/otbLocalHoughDraw.cxx index f6cf5e7c85..cd5f2950f1 100644 --- a/Testing/Code/FeatureExtraction/otbLocalHoughDraw.cxx +++ b/Testing/Code/FeatureExtraction/otbLocalHoughDraw.cxx @@ -38,69 +38,62 @@ #include "itkRescaleIntensityImageFilter.h" - -int otbLocalHoughDraw( int argc, char* argv[] ) +int otbLocalHoughDraw(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int RadiusX((unsigned int)::atoi(argv[3])); - unsigned int RadiusY((unsigned int)::atoi(argv[4])); - unsigned int NumberOfLines((unsigned int)::atoi(argv[5])); + unsigned int RadiusX((unsigned int) ::atoi(argv[3])); + unsigned int RadiusY((unsigned int) ::atoi(argv[4])); + unsigned int NumberOfLines((unsigned int) ::atoi(argv[5])); - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::LocalHoughFilter< InputImageType > FilterType; + typedef otb::LocalHoughFilter<InputImageType> FilterType; //typedef otb::ImageToLineSpatialObjectListFilter< InputImageType > FilterType; FilterType::Pointer filter = FilterType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; typedef itk::RescaleIntensityImageFilter<InputImageType> RescalerType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); RescalerType::Pointer rescaler = RescalerType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->Update(); - writer->SetFileName( outputFilename ); + writer->SetFileName(outputFilename); FilterType::SizeType Radius; Radius[0] = RadiusX; Radius[1] = RadiusY; - - filter->SetRadius( Radius ); - filter->SetNumberOfLines( NumberOfLines ); + filter->SetRadius(Radius); + filter->SetNumberOfLines(NumberOfLines); rescaler->SetInput(reader->GetOutput()); - filter->SetInput( rescaler->GetOutput() ); + filter->SetInput(rescaler->GetOutput()); filter->Update(); - - typedef otb::DrawLineSpatialObjectListFilter< InputImageType,OutputImageType > DrawFilterType; + typedef otb::DrawLineSpatialObjectListFilter<InputImageType, OutputImageType> DrawFilterType; DrawFilterType::Pointer drawfilter = DrawFilterType::New(); - drawfilter->SetInputLineSpatialObjectList(filter->GetOutput()); - drawfilter->SetInput( reader->GetOutput() ); - writer->SetInput( drawfilter->GetOutput() ); + drawfilter->SetInput(reader->GetOutput()); + writer->SetInput(drawfilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbLocalHoughNew.cxx b/Testing/Code/FeatureExtraction/otbLocalHoughNew.cxx index fc741a5bac..0ff2d4fd73 100644 --- a/Testing/Code/FeatureExtraction/otbLocalHoughNew.cxx +++ b/Testing/Code/FeatureExtraction/otbLocalHoughNew.cxx @@ -20,29 +20,23 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include "otbImage.h" - #include <iostream> #include "otbLocalHoughFilter.h" - -int otbLocalHoughNew( int argc, char* argv[] ) +int otbLocalHoughNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::LocalHoughFilter< InputImageType > FilterType; + typedef otb::LocalHoughFilter<InputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbModulusAndDirectionImageFiltersNew.cxx b/Testing/Code/FeatureExtraction/otbModulusAndDirectionImageFiltersNew.cxx index a05b01c55b..af7cfa781c 100644 --- a/Testing/Code/FeatureExtraction/otbModulusAndDirectionImageFiltersNew.cxx +++ b/Testing/Code/FeatureExtraction/otbModulusAndDirectionImageFiltersNew.cxx @@ -26,28 +26,28 @@ #include "otbImageToModulusAndDirectionImageFilter.h" #include "otbModulusAndDirectionImageToImageFilter.h" -int otbModulusAndDirectionImageFiltersNew( int argc, char* argv[] ) +int otbModulusAndDirectionImageFiltersNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > InputImageDirectionType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageDirectionType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> InputImageDirectionType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageDirectionType; - typedef otb::ImageToModulusAndDirectionImageFilter< InputImageType, OutputImageType> FilterType; - typedef otb::ImageToModulusAndDirectionImageFilter< InputImageType, OutputImageType, OutputImageDirectionType> Filter2Type; + typedef otb::ImageToModulusAndDirectionImageFilter<InputImageType, + OutputImageType> FilterType; + typedef otb::ImageToModulusAndDirectionImageFilter<InputImageType, OutputImageType, + OutputImageDirectionType> Filter2Type; - FilterType::Pointer Filter = FilterType::New(); + FilterType::Pointer Filter = FilterType::New(); Filter2Type::Pointer Filter2 = Filter2Type::New(); - typedef otb::ModulusAndDirectionImageToImageFilter< InputImageType, InputImageDirectionType, OutputImageType> Filter3Type; + typedef otb::ModulusAndDirectionImageToImageFilter<InputImageType, InputImageDirectionType, + OutputImageType> Filter3Type; Filter3Type::Pointer Filter3 = Filter3Type::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbMultiplyByScalarImageTest.cxx b/Testing/Code/FeatureExtraction/otbMultiplyByScalarImageTest.cxx index b6470ed4c7..fa12a4b1fd 100644 --- a/Testing/Code/FeatureExtraction/otbMultiplyByScalarImageTest.cxx +++ b/Testing/Code/FeatureExtraction/otbMultiplyByScalarImageTest.cxx @@ -25,29 +25,29 @@ #include "itkImageRegionIteratorWithIndex.h" #include "otbMultiplyByScalarImageFilter.h" -int otbMultiplyByScalarImageFilterTest( int argc, char * argv[] ) +int otbMultiplyByScalarImageFilterTest(int argc, char * argv[]) { // Define the dimension of the images const unsigned int ImageDimension = 2; // Declare the types of the images - typedef itk::Image<float, ImageDimension> InputImageType; - typedef itk::Image<float, ImageDimension> OutputImageType; + typedef itk::Image<float, ImageDimension> InputImageType; + typedef itk::Image<float, ImageDimension> OutputImageType; // Declare Iterator types apropriated for each image typedef itk::ImageRegionIteratorWithIndex< - InputImageType> InputIteratorType; + InputImageType> InputIteratorType; typedef itk::ImageRegionIteratorWithIndex< - OutputImageType> OutputIteratorType; + OutputImageType> OutputIteratorType; // Declare the type of the index to access images - typedef itk::Index<ImageDimension> IndexType; + typedef itk::Index<ImageDimension> IndexType; // Declare the type of the size - typedef itk::Size<ImageDimension> SizeType; + typedef itk::Size<ImageDimension> SizeType; // Declare the type of the Region - typedef itk::ImageRegion<ImageDimension> RegionType; + typedef itk::ImageRegion<ImageDimension> RegionType; // Create two images InputImageType::Pointer inputImage = InputImageType::New(); @@ -62,35 +62,35 @@ int otbMultiplyByScalarImageFilterTest( int argc, char * argv[] ) start[1] = 0; RegionType region; - region.SetIndex( start ); - region.SetSize( size ); + region.SetIndex(start); + region.SetSize(size); // Initialize Image A - inputImage->SetRegions( region ); + inputImage->SetRegions(region); inputImage->Allocate(); // Create one iterator for the Input Image (this is a light object) - InputIteratorType it( inputImage, inputImage->GetBufferedRegion() ); + InputIteratorType it(inputImage, inputImage->GetBufferedRegion()); // Initialize the content of Image A - const double pi = vcl_atan( 1.0 ) * 4.0; + const double pi = vcl_atan(1.0) * 4.0; const double value = pi / 6.0; std::cout << "Content of the Input " << std::endl; it.GoToBegin(); - while ( !it.IsAtEnd() ) - { - it.Set( value ); + while (!it.IsAtEnd()) + { + it.Set(value); std::cout << it.Get() << std::endl; ++it; - } + } // Declare the type for the Acos filter - typedef otb::MultiplyByScalarImageFilter< InputImageType, OutputImageType> FilterType; + typedef otb::MultiplyByScalarImageFilter<InputImageType, OutputImageType> FilterType; // Create a MultiplyScalarImage Filter FilterType::Pointer filter = FilterType::New(); // Connect the input images - filter->SetInput( inputImage ); + filter->SetInput(inputImage); // Get the Smart Pointer to the Filter Output OutputImageType::Pointer outputImage = filter->GetOutput(); @@ -107,26 +107,24 @@ int otbMultiplyByScalarImageFilterTest( int argc, char * argv[] ) const OutputImageType::PixelType epsilon = 1e-6; ot.GoToBegin(); it.GoToBegin(); - while ( !ot.IsAtEnd() ) - { + while (!ot.IsAtEnd()) + { std::cout << ot.Get() << " = "; - std::cout << 10.0 * ( it.Get() ) << std::endl; + std::cout << 10.0 * (it.Get()) << std::endl; const InputImageType::PixelType input = it.Get(); const OutputImageType::PixelType output = ot.Get(); - const OutputImageType::PixelType multiplyByScal = 10.0* input; - if ( vcl_abs( multiplyByScal - output ) > epsilon ) - { + const OutputImageType::PixelType multiplyByScal = 10.0 * input; + if (vcl_abs(multiplyByScal - output) > epsilon) + { std::cerr << "Error in otbMultiplyScalarImageFilterTest " << std::endl; std::cerr << " 10.0 * " << input << ") = " << multiplyByScal << std::endl; std::cerr << " differs from " << output; std::cerr << " by more than " << epsilon << std::endl; return 1; - } + } ++ot; ++it; - } - + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.cxx b/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.cxx index d070aabddf..0768cd2785 100644 --- a/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.cxx @@ -32,21 +32,20 @@ int otbNeighborhoodScalarProductFilter(int argc, char * argv[]) const double sigma = atof(argv[4]); const unsigned int Dimension = 2; - typedef double PixelType; - typedef itk::CovariantVector<PixelType,Dimension> VectorPixelType; - typedef otb::Image<VectorPixelType,Dimension> VectorImageType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::NeighborhoodScalarProductFilter<VectorImageType,ImageType,ImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::ImageFileWriter<VectorImageType> TempWriter; - typedef itk::GradientRecursiveGaussianImageFilter<ImageType,VectorImageType> GradientFilterType; - + typedef double PixelType; + typedef itk::CovariantVector<PixelType, Dimension> VectorPixelType; + typedef otb::Image<VectorPixelType, Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::NeighborhoodScalarProductFilter<VectorImageType, ImageType, ImageType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::ImageFileWriter<VectorImageType> TempWriter; + typedef itk::GradientRecursiveGaussianImageFilter<ImageType, VectorImageType> GradientFilterType; // Instantiating object - FilterType::Pointer filter = FilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + FilterType::Pointer filter = FilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); GradientFilterType::Pointer gradient = GradientFilterType::New(); reader->SetFileName(infname); diff --git a/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilterNew.cxx b/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilterNew.cxx index 0b5e13b4ca..66c2e55f1d 100644 --- a/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilterNew.cxx @@ -23,15 +23,14 @@ int otbNeighborhoodScalarProductFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef itk::CovariantVector<PixelType,Dimension> VectorPixelType; - typedef otb::Image<VectorPixelType,Dimension> InputImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; - typedef otb::NeighborhoodScalarProductFilter<InputImageType,OutputImageType,OutputImageType> FilterType; + typedef double PixelType; + typedef itk::CovariantVector<PixelType, Dimension> VectorPixelType; + typedef otb::Image<VectorPixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; + typedef otb::NeighborhoodScalarProductFilter<InputImageType, OutputImageType, OutputImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.cxx b/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.cxx index c9a66ba55c..a1974b0915 100644 --- a/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.cxx @@ -24,11 +24,11 @@ int otbNonMaxRemovalByDirectionFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::NonMaxRemovalByDirectionFilter<ImageType,ImageType,ImageType> NonMaxRemovalByDirectionFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::NonMaxRemovalByDirectionFilter<ImageType, ImageType, ImageType> NonMaxRemovalByDirectionFilterType; // Instantiating object ReaderType::Pointer modReader = ReaderType::New(); @@ -43,6 +43,5 @@ int otbNonMaxRemovalByDirectionFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilterNew.cxx b/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilterNew.cxx index 9533b6ad6e..9dce1f7ddb 100644 --- a/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilterNew.cxx @@ -23,13 +23,12 @@ int otbNonMaxRemovalByDirectionFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::NonMaxRemovalByDirectionFilter<ImageType,ImageType,ImageType> NonMaxRemovalByDirectionFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::NonMaxRemovalByDirectionFilter<ImageType, ImageType, ImageType> NonMaxRemovalByDirectionFilterType; // Instantiating object NonMaxRemovalByDirectionFilterType::Pointer object = NonMaxRemovalByDirectionFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbOrientationPath.cxx b/Testing/Code/FeatureExtraction/otbOrientationPath.cxx index 3a8d50fff7..9eebec7dcc 100644 --- a/Testing/Code/FeatureExtraction/otbOrientationPath.cxx +++ b/Testing/Code/FeatureExtraction/otbOrientationPath.cxx @@ -26,42 +26,40 @@ #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" -int otbOrientationPath( int argc, char * argv[] ) +int otbOrientationPath(int argc, char * argv[]) { - double Theta((double)::atof(argv[1])); + double Theta((double) ::atof(argv[1])); - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::OrientationPathFunction<PathType> FunctionType; - typedef FunctionType::RealType RealType; + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::OrientationPathFunction<PathType> FunctionType; + typedef FunctionType::RealType RealType; PathType::ContinuousIndexType cindex; - PathType::Pointer pathElt = PathType::New(); + PathType::Pointer pathElt = PathType::New(); - Theta *= otb::CONST_PI/180.; + Theta *= otb::CONST_PI / 180.; pathElt->Initialize(); - cindex[0]=30; - cindex[1]=30; + cindex[0] = 30; + cindex[1] = 30; pathElt->AddVertex(cindex); cindex[0] += 100 * vcl_cos(Theta); cindex[1] += 100 * vcl_sin(Theta); pathElt->AddVertex(cindex); - FunctionType::Pointer function =FunctionType::New(); - function->SetInputPath( pathElt ); + FunctionType::Pointer function = FunctionType::New(); + function->SetInputPath(pathElt); RealType ResultTheta = function->Evaluate(); std::cout.precision(10); - std::cout << "Orientation found : " << ResultTheta <<std::endl; - if ( vcl_abs(static_cast<double>(ResultTheta-Theta))>=10e-15) - { - std::cout << "Error in Theta estimation:" <<(ResultTheta-Theta)<<std::endl; + std::cout << "Orientation found : " << ResultTheta << std::endl; + if (vcl_abs(static_cast<double>(ResultTheta - Theta)) >= 10e-15) + { + std::cout << "Error in Theta estimation:" << (ResultTheta - Theta) << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbOrientationPathNew.cxx b/Testing/Code/FeatureExtraction/otbOrientationPathNew.cxx index 5e29b93f55..fd7f96378c 100644 --- a/Testing/Code/FeatureExtraction/otbOrientationPathNew.cxx +++ b/Testing/Code/FeatureExtraction/otbOrientationPathNew.cxx @@ -25,15 +25,13 @@ #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" -int otbOrientationPathNew( int argc, char * argv[] ) +int otbOrientationPathNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::OrientationPathFunction<PathType> FunctionType; - - FunctionType::Pointer function =FunctionType::New(); + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::OrientationPathFunction<PathType> FunctionType; + FunctionType::Pointer function = FunctionType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbPanTexTextureImageFilter.cxx b/Testing/Code/FeatureExtraction/otbPanTexTextureImageFilter.cxx index 6d01df7f1e..1089c75553 100644 --- a/Testing/Code/FeatureExtraction/otbPanTexTextureImageFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbPanTexTextureImageFilter.cxx @@ -22,14 +22,13 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbPanTexTextureImageFilter(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; typedef otb::PanTexTextureImageFilter<ImageType, ImageType> PanTexType; // Instantiating object @@ -39,10 +38,10 @@ int otbPanTexTextureImageFilter(int argc, char * argv[]) reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); - panTex->SetInput( reader->GetOutput() ); - writer->SetInput( panTex->GetOutput() ); + panTex->SetInput(reader->GetOutput()); + writer->SetInput(panTex->GetOutput()); writer->Update(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbPanTexTextureImageFilterNew.cxx b/Testing/Code/FeatureExtraction/otbPanTexTextureImageFilterNew.cxx index 46389035a5..ecc6bbd025 100644 --- a/Testing/Code/FeatureExtraction/otbPanTexTextureImageFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbPanTexTextureImageFilterNew.cxx @@ -22,13 +22,13 @@ int otbPanTexTextureImageFilterNew(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; typedef otb::PanTexTextureImageFilter<ImageType, ImageType> PanTexType; // Instantiating object PanTexType::Pointer object = PanTexType::New(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbPanTexTextureImageFunctionFilter.cxx b/Testing/Code/FeatureExtraction/otbPanTexTextureImageFunctionFilter.cxx index a732b61ded..16fc285a59 100644 --- a/Testing/Code/FeatureExtraction/otbPanTexTextureImageFunctionFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbPanTexTextureImageFunctionFilter.cxx @@ -22,14 +22,13 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbPanTexTextureImageFunctionFilter(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; typedef otb::PanTexTextureImageFunctionFilter<ImageType, ImageType> PanTexType; // Instantiating object @@ -39,10 +38,10 @@ int otbPanTexTextureImageFunctionFilter(int argc, char * argv[]) reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); - panTex->SetInput( reader->GetOutput() ); - writer->SetInput( panTex->GetOutput() ); + panTex->SetInput(reader->GetOutput()); + writer->SetInput(panTex->GetOutput()); writer->Update(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbPanTexTextureImageFunctionFilterNew.cxx b/Testing/Code/FeatureExtraction/otbPanTexTextureImageFunctionFilterNew.cxx index 1fe47450eb..f276030c27 100644 --- a/Testing/Code/FeatureExtraction/otbPanTexTextureImageFunctionFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbPanTexTextureImageFunctionFilterNew.cxx @@ -22,13 +22,13 @@ int otbPanTexTextureImageFunctionFilterNew(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; typedef otb::PanTexTextureImageFunctionFilter<ImageType, ImageType> PanTexType; // Instantiating object PanTexType::Pointer object = PanTexType::New(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbParallelLinePathListFilter.cxx b/Testing/Code/FeatureExtraction/otbParallelLinePathListFilter.cxx index 0f2ec9cc44..400eefc53d 100644 --- a/Testing/Code/FeatureExtraction/otbParallelLinePathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbParallelLinePathListFilter.cxx @@ -26,14 +26,13 @@ int otbParallelLinePathListFilter(int argc, char * argv[]) // We create some lines const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::ObjectList< PathType > PathListType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::ObjectList<PathType> PathListType; PathListType::Pointer lineList = PathListType::New(); PathListType::Pointer parallelList = PathListType::New(); - - typedef PathType::ContinuousIndexType ContinuousIndexType; + typedef PathType::ContinuousIndexType ContinuousIndexType; ContinuousIndexType cindex; /*-----*/ @@ -41,41 +40,40 @@ int otbParallelLinePathListFilter(int argc, char * argv[]) aLine->Initialize(); cindex[0] = 1; cindex[1] = 1; - aLine->AddVertex( cindex ); + aLine->AddVertex(cindex); cindex[0] = 1; cindex[1] = 100; - aLine->AddVertex( cindex ); + aLine->AddVertex(cindex); - lineList->PushBack( aLine ); - parallelList->PushBack( aLine ); + lineList->PushBack(aLine); + parallelList->PushBack(aLine); /*-----*/ aLine = PathType::New(); aLine->Initialize(); cindex[0] = 10; cindex[1] = 1; - aLine->AddVertex( cindex ); + aLine->AddVertex(cindex); cindex[0] = 10; cindex[1] = 100; - aLine->AddVertex( cindex ); - parallelList->PushBack( aLine ); - lineList->PushBack( aLine ); + aLine->AddVertex(cindex); + parallelList->PushBack(aLine); + lineList->PushBack(aLine); /*-----*/ aLine = PathType::New(); aLine->Initialize(); cindex[0] = 174; cindex[1] = 99; - aLine->AddVertex( cindex ); + aLine->AddVertex(cindex); cindex[0] = 281; cindex[1] = 1; - aLine->AddVertex( cindex ); - - lineList->PushBack( aLine ); + aLine->AddVertex(cindex); + lineList->PushBack(aLine); // Parallel lines are detected. @@ -87,15 +85,14 @@ int otbParallelLinePathListFilter(int argc, char * argv[]) parallelLinePathListFilter->SetInput(lineList); parallelLinePathListFilter->Update(); - - PathListType::Pointer pathList = parallelLinePathListFilter->GetOutput(); + PathListType::Pointer pathList = parallelLinePathListFilter->GetOutput(); PathListType::Iterator listIt = pathList->Begin(); PathListType::Iterator parListIt = parallelList->Begin(); // A path is a line segment in this case. while (listIt != pathList->End() && parListIt != parallelList->End()) - { + { PathType::VertexListType::ConstPointer vertexList = (listIt.Get())->GetVertexList(); PathType::VertexListType::ConstPointer parVertexList = (parListIt.Get())->GetVertexList(); @@ -105,21 +102,20 @@ int otbParallelLinePathListFilter(int argc, char * argv[]) // Loop over all the vertices in one path while (pathIt != vertexList->End() && parPathIt != parVertexList->End()) - { - - if ( pathIt.Value() != parPathIt.Value() ) { + + if (pathIt.Value() != parPathIt.Value()) + { std::cout << pathIt.Index() << pathIt.Value() << std::endl; return EXIT_FAILURE; - } + } ++pathIt; ++parPathIt; - } + } ++listIt; ++parListIt; - } - + } return EXIT_SUCCESS; diff --git a/Testing/Code/FeatureExtraction/otbParallelLinePathListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbParallelLinePathListFilterNew.cxx index aa77008aae..730d3b01b8 100644 --- a/Testing/Code/FeatureExtraction/otbParallelLinePathListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbParallelLinePathListFilterNew.cxx @@ -23,7 +23,7 @@ int otbParallelLinePathListFilterNew(int argc, char * argv[]) { - const unsigned int Dimension =2; + const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::ParallelLinePathListFilter<PathType> ParallelLinePathType; diff --git a/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirection.cxx b/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirection.cxx index 6ec57773ba..368b024654 100644 --- a/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirection.cxx +++ b/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirection.cxx @@ -29,56 +29,50 @@ #include "otbImageFileWriter.h" #include "otbPixelSuppressionByDirectionImageFilter.h" -int otbPixelSuppressionByDirection( int argc, char* argv[] ) +int otbPixelSuppressionByDirection(int argc, char* argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; const char * outputFilename = argv[3]; - unsigned int RadiusX((unsigned int)::atoi(argv[4])); - float AngularBeam((float)::atof(argv[5])); + unsigned int RadiusX((unsigned int) ::atoi(argv[4])); + float AngularBeam((float) ::atof(argv[5])); - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType1; - typedef otb::ImageFileReader< InputImageType > ReaderType2; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType1; + typedef otb::ImageFileReader<InputImageType> ReaderType2; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::PixelSuppressionByDirectionImageFilter< InputImageType, OutputImageType > FilterType; + typedef otb::PixelSuppressionByDirectionImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - FilterType::SizeType Radius; Radius[0] = RadiusX; Radius[1] = RadiusX; - - filter->SetRadius( Radius ); - filter->SetAngularBeam( AngularBeam ); - + filter->SetRadius(Radius); + filter->SetAngularBeam(AngularBeam); ReaderType1::Pointer reader1 = ReaderType1::New(); ReaderType2::Pointer reader2 = ReaderType2::New(); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); - filter->SetInputImage( reader1->GetOutput() ); - filter->SetInputImageDirection( reader2->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInputImage(reader1->GetOutput()); + filter->SetInputImageDirection(reader2->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirectionNew.cxx b/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirectionNew.cxx index 5c69623263..79a9b15776 100644 --- a/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirectionNew.cxx +++ b/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirectionNew.cxx @@ -29,25 +29,22 @@ #include "otbImageFileWriter.h" #include "otbPixelSuppressionByDirectionImageFilter.h" -int otbPixelSuppressionByDirectionNew( int argc, char* argv[] ) +int otbPixelSuppressionByDirectionNew(int argc, char* argv[]) { - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType1; - typedef otb::ImageFileReader< InputImageType > ReaderType2; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType1; + typedef otb::ImageFileReader<InputImageType> ReaderType2; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::PixelSuppressionByDirectionImageFilter< InputImageType, OutputImageType > FilterType; + typedef otb::PixelSuppressionByDirectionImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilter.cxx index 75d987f510..5dddae3eef 100644 --- a/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilter.cxx @@ -25,35 +25,31 @@ #include <stdio.h> #include <iostream> - int otbRegionImageToRectangularPathListFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - - typedef unsigned short InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned short InputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->Update(); - - typedef otb::PolyLineParametricPathWithValue< double, Dimension > PathType; - typedef otb::RegionImageToRectangularPathListFilter<InputImageType,PathType> - RectangleListFilterType; + typedef otb::PolyLineParametricPathWithValue<double, Dimension> PathType; + typedef otb::RegionImageToRectangularPathListFilter<InputImageType, PathType> + RectangleListFilterType; RectangleListFilterType::Pointer rectangleFilter = - RectangleListFilterType::New(); + RectangleListFilterType::New(); - rectangleFilter->SetInput( reader->GetOutput() ); + rectangleFilter->SetInput(reader->GetOutput()); rectangleFilter->SetMinimumFit(::atof(argv[3])); rectangleFilter->SetMinimumSize(::atoi(argv[4])); @@ -66,35 +62,32 @@ int otbRegionImageToRectangularPathListFilter(int argc, char * argv[]) ListType::Iterator listIt = pathList->Begin(); - FILE *file = fopen(outputFilename,"w"); + FILE *file = fopen(outputFilename, "w"); if (file == NULL) - { - fprintf(stderr,"Error, can't open file"); + { + fprintf(stderr, "Error, can't open file"); exit(-1); - } - - while(listIt != pathList->End()) + } + + while (listIt != pathList->End()) { - for (PathType::VertexListType::ConstIterator vit = listIt.Get()->GetVertexList()->Begin(); - vit != listIt.Get()->GetVertexList()->End();++vit) - { - double x = vit.Value()[0]; - double y = vit.Value()[1]; - fprintf(file,"%8.3f %8.3f\n",x,y); - - } + for (PathType::VertexListType::ConstIterator vit = listIt.Get()->GetVertexList()->Begin(); + vit != listIt.Get()->GetVertexList()->End(); ++vit) + { + double x = vit.Value()[0]; + double y = vit.Value()[1]; + fprintf(file, "%8.3f %8.3f\n", x, y); - double score = listIt.Get()->GetValue(); - fprintf(file,"%8.3f\n",score); + } + double score = listIt.Get()->GetValue(); + fprintf(file, "%8.3f\n", score); - ++listIt; + ++listIt; } - fclose(file); - + fclose(file); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilterNew.cxx index aefc8b7fcf..22a1294b33 100644 --- a/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilterNew.cxx @@ -22,18 +22,17 @@ int otbRegionImageToRectangularPathListFilterNew(int argc, char * argv[]) { - typedef unsigned short InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned short InputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - - typedef otb::PolyLineParametricPathWithValue< double, Dimension > PathType; - typedef otb::RegionImageToRectangularPathListFilter<InputImageType,PathType> - RectangleListFilterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; - RectangleListFilterType::Pointer rectangleFilter = - RectangleListFilterType::New(); + typedef otb::PolyLineParametricPathWithValue<double, Dimension> PathType; + typedef otb::RegionImageToRectangularPathListFilter<InputImageType, PathType> + RectangleListFilterType; + RectangleListFilterType::Pointer rectangleFilter = + RectangleListFilterType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbRemoveCarvingPathFilterNew.cxx b/Testing/Code/FeatureExtraction/otbRemoveCarvingPathFilterNew.cxx index de4bb2f6d5..4afa734e33 100644 --- a/Testing/Code/FeatureExtraction/otbRemoveCarvingPathFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbRemoveCarvingPathFilterNew.cxx @@ -26,18 +26,17 @@ int otbRemoveCarvingPathFilterNew(int argc, char* argv[]) { - typedef double PixelType; - const unsigned int Dimension = 2; + typedef double PixelType; + const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > InputImageType; - typedef otb::Image< PixelType, Dimension > OutputImageType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::RemoveCarvingPathFilter<InputImageType, PathType, - OutputImageType> RemoveCarvingPathFilterType; + OutputImageType> RemoveCarvingPathFilterType; RemoveCarvingPathFilterType::Pointer addCarvingPathFilter = RemoveCarvingPathFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilter.cxx b/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilter.cxx index 238d684860..e80603a256 100644 --- a/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilter.cxx @@ -24,11 +24,11 @@ int otbRemoveIsolatedByDirectionFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::RemoveIsolatedByDirectionFilter<ImageType,ImageType,ImageType> RemoveIsolatedByDirectionFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::RemoveIsolatedByDirectionFilter<ImageType, ImageType, ImageType> RemoveIsolatedByDirectionFilterType; // Instantiating object ReaderType::Pointer modReader = ReaderType::New(); diff --git a/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilterNew.cxx b/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilterNew.cxx index cad2b64da9..1f8b73e586 100644 --- a/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilterNew.cxx @@ -23,9 +23,9 @@ int otbRemoveIsolatedByDirectionFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::RemoveIsolatedByDirectionFilter<ImageType,ImageType,ImageType> RemoveIsolatedByDirectionFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::RemoveIsolatedByDirectionFilter<ImageType, ImageType, ImageType> RemoveIsolatedByDirectionFilterType; // Instantiating object RemoveIsolatedByDirectionFilterType::Pointer object = RemoveIsolatedByDirectionFilterType::New(); diff --git a/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.cxx index eb37db8bd5..a852e5ac9b 100644 --- a/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.cxx @@ -27,58 +27,57 @@ int otbRemoveTortuousPathListFilter(int argc, char * argv[]) const char * outfname = argv[1]; const double threshold = atof(argv[2]); - typedef std::vector<double> PointsVectorType; - typedef std::vector< PointsVectorType > PointsMatrixType; + typedef std::vector<double> PointsVectorType; + typedef std::vector<PointsVectorType> PointsMatrixType; PointsMatrixType MatricePoints; PointsVectorType ListPoints; int cpt = 3; ListPoints.clear(); - while ( argv[cpt] != NULL ) - { - if ( argv[cpt][0] == '|' ) + while (argv[cpt] != NULL) { - if ( (ListPoints.size()%2) != 0 ) + if (argv[cpt][0] == '|') { - itkGenericExceptionMacro(<<"Missing point in parameters !"); - } + if ((ListPoints.size() % 2) != 0) + { + itkGenericExceptionMacro(<< "Missing point in parameters !"); + } MatricePoints.push_back(ListPoints); ListPoints.clear(); - } + } else - { + { ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } + } cpt++; - } + } MatricePoints.push_back(ListPoints); const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::RemoveTortuousPathListFilter<PathType> RemoveTortuousPathListFilterType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::RemoveTortuousPathListFilter<PathType> RemoveTortuousPathListFilterType; typedef RemoveTortuousPathListFilterType::InputListType PathListType; PathType::ContinuousIndexType cindex; - PathListType::Pointer InputPathList = PathListType::New(); //Generate PathList - for (PointsMatrixType::iterator listpos=MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { + for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) + { PathType::Pointer path = PathType::New(); //Generate PathList - std::cout << "List "<<std::endl; - for (PointsVectorType::iterator it=(*listpos).begin(); it != (*listpos).end(); ++it) - { + std::cout << "List " << std::endl; + for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) + { cindex[0] = *it; ++it; cindex[1] = *it; - std::cout << "Point Index :"<<cindex[0]<<";"<<cindex[1]<<std::endl; + std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; path->AddVertex(cindex); - } + } InputPathList->PushBack(path); - } + } // Instantiating object RemoveTortuousPathListFilterType::Pointer filter = RemoveTortuousPathListFilterType::New(); @@ -88,56 +87,55 @@ int otbRemoveTortuousPathListFilter(int argc, char * argv[]) PathListType::Pointer OutputPathList = filter->GetOutput(); - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; + typedef PathListType::ConstIterator PathListIteratorType; + typedef PathType::VertexListType VertexListType; typedef VertexListType::ConstIterator VertexIteratorType; std::ofstream file; file.open(outfname); - unsigned int counter = 1; + unsigned int counter = 1; PathListIteratorType pathListIt = InputPathList->Begin(); - file<<"Minimum Mean Distance: "<<filter->GetFunctor().GetThreshold()<< " ("<<threshold<<")"<<std::endl; - file<<"INPUT list of Path "<<": "<<std::endl; - while (pathListIt!=InputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "Minimum Mean Distance: " << filter->GetFunctor().GetThreshold() << " (" << threshold << ")" << std::endl; + file << "INPUT list of Path " << ": " << std::endl; + while (pathListIt != InputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } counter = 1; pathListIt = OutputPathList->Begin(); - file<<"OUTPUT list of Path "<<": "<<std::endl; - while (pathListIt!=OutputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "OUTPUT list of Path " << ": " << std::endl; + while (pathListIt != OutputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilterNew.cxx index 72942c56c6..d1908fdd30 100644 --- a/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilterNew.cxx @@ -23,8 +23,8 @@ int otbRemoveTortuousPathListFilterNew(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef itk::PolyLineParametricPath<Dimension> PathType; + const unsigned int Dimension = 2; + typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::RemoveTortuousPathListFilter<PathType> RemoveTortuousPathListFilterType; // Instantiating object diff --git a/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilter.cxx b/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilter.cxx index a7a3215802..6c29ccdce7 100644 --- a/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilter.cxx @@ -24,11 +24,11 @@ int otbRemoveWrongDirectionFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::RemoveWrongDirectionFilter<ImageType,ImageType,ImageType> RemoveWrongDirectionFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::RemoveWrongDirectionFilter<ImageType, ImageType, ImageType> RemoveWrongDirectionFilterType; // Instantiating object ReaderType::Pointer modReader = ReaderType::New(); @@ -43,6 +43,5 @@ int otbRemoveWrongDirectionFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilterNew.cxx b/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilterNew.cxx index dd1598effc..0f9d11f691 100644 --- a/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilterNew.cxx @@ -23,13 +23,12 @@ int otbRemoveWrongDirectionFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::RemoveWrongDirectionFilter<ImageType,ImageType,ImageType> RemoveWrongDirectionFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::RemoveWrongDirectionFilter<ImageType, ImageType, ImageType> RemoveWrongDirectionFilterType; // Instantiating object RemoveWrongDirectionFilterType::Pointer object = RemoveWrongDirectionFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx b/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx index 6ccd33f7ee..5e9667ec66 100644 --- a/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx @@ -30,40 +30,40 @@ int otbRoadExtractionFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; - typedef otb::PolyLineParametricPathWithValue<double,Dimension> PathType; - - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::RoadExtractionFilter<InputImageType,PathType> RoadExtractionFilterType; - typedef RoadExtractionFilterType::OutputPathListType OutputPathListType; - typedef RoadExtractionFilterType::InputPixelType InputPixelType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; + typedef otb::PolyLineParametricPathWithValue<double, Dimension> PathType; + + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::RoadExtractionFilter<InputImageType, PathType> RoadExtractionFilterType; + typedef RoadExtractionFilterType::OutputPathListType OutputPathListType; + typedef RoadExtractionFilterType::InputPixelType InputPixelType; typedef otb::DrawPathListFilter<OutputImageType, PathType, OutputImageType> DrawPathFilterType; //Parameters - const char * inputFileName(argv[1]); - const char * outputFileName(argv[2]); + const char * inputFileName(argv[1]); + const char * outputFileName(argv[2]); InputPixelType ReferencePixel; ReferencePixel.Reserve(4); - ReferencePixel.SetElement(0,::atof(argv[3])); - ReferencePixel.SetElement(1,::atof(argv[4])); - ReferencePixel.SetElement(2,::atof(argv[5])); - ReferencePixel.SetElement(3,::atof(argv[6])); + ReferencePixel.SetElement(0, ::atof(argv[3])); + ReferencePixel.SetElement(1, ::atof(argv[4])); + ReferencePixel.SetElement(2, ::atof(argv[5])); + ReferencePixel.SetElement(3, ::atof(argv[6])); const double Alpha = ::atof(argv[7]); const double AmplitudeThreshold = ::atof(argv[8]); const double Tolerance = ::atof(argv[9]); - const double MaxAngle = ((otb::CONST_PI*::atof(argv[10]))/180.); + const double MaxAngle = ((otb::CONST_PI * ::atof(argv[10])) / 180.); const double FirstMeanDistanceThreshold = ::atof(argv[11]); const double SecondMeanDistanceThreshold = ::atof(argv[12]); - const double LinkAngularThreshold = ((otb::CONST_PI*::atof(argv[13]))/180.); + const double LinkAngularThreshold = ((otb::CONST_PI * ::atof(argv[13])) / 180.); const double LinkDistanceThreshold = ::atof(argv[14]); // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); RoadExtractionFilterType::Pointer roadExtraction = RoadExtractionFilterType::New(); - DrawPathFilterType::Pointer draw = DrawPathFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + DrawPathFilterType::Pointer draw = DrawPathFilterType::New(); + WriterType::Pointer writer = WriterType::New(); //Initialization parameters reader->SetFileName(inputFileName); @@ -79,7 +79,6 @@ int otbRoadExtractionFilter(int argc, char * argv[]) roadExtraction->SetAngularThreshold(LinkAngularThreshold); roadExtraction->SetDistanceThreshold(LinkDistanceThreshold); - reader->GenerateOutputInformation(); OutputImageType::Pointer image = OutputImageType::New(); image->SetRegions(reader->GetOutput()->GetLargestPossibleRegion()); @@ -95,6 +94,5 @@ int otbRoadExtractionFilter(int argc, char * argv[]) writer->SetInput(draw->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbRoadExtractionFilterNew.cxx b/Testing/Code/FeatureExtraction/otbRoadExtractionFilterNew.cxx index f058050045..1c04afd64c 100644 --- a/Testing/Code/FeatureExtraction/otbRoadExtractionFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbRoadExtractionFilterNew.cxx @@ -24,14 +24,13 @@ int otbRoadExtractionFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double,Dimension> InputImageType; + typedef otb::VectorImage<double, Dimension> InputImageType; typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::RoadExtractionFilter<InputImageType,PathType> RoadExtractionFilterType; + typedef otb::RoadExtractionFilter<InputImageType, PathType> RoadExtractionFilterType; // Instantiating object RoadExtractionFilterType::Pointer object = RoadExtractionFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterNew.cxx b/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterNew.cxx index 953bb8b74a..0da04b9d67 100644 --- a/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterNew.cxx @@ -21,17 +21,15 @@ #include "otbVectorImage.h" #include "otbImage.h" - int otbSFSTexturesImageFilterNew(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; //typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; typedef otb::SFSTexturesImageFilter<ImageType, ImageType> FilterType; FilterType::Pointer filter = FilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx b/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx index 3d1391add4..572ba3a43e 100644 --- a/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx +++ b/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx @@ -22,26 +22,24 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbSFSTexturesImageFilterTest(int argc, char * argv[]) { typedef double PixelType; - const unsigned int Dimension =2; - - std::string inName = argv[1]; - std::string outNameLength = argv[2]; - std::string outNameWidth = argv[3]; - std::string outNameWMean = argv[4]; - std::string outNameRatio = argv[5]; - std::string outNameSD = argv[6]; - PixelType spectThresh = atof(argv[7]); + const unsigned int Dimension = 2; + + std::string inName = argv[1]; + std::string outNameLength = argv[2]; + std::string outNameWidth = argv[3]; + std::string outNameWMean = argv[4]; + std::string outNameRatio = argv[5]; + std::string outNameSD = argv[6]; + PixelType spectThresh = atof(argv[7]); unsigned int spatialThresh = atoi(argv[8]); unsigned int dirNb = atoi(argv[9]); unsigned int maxConsideration = atoi(argv[10]); - double alpha = atof(argv[11]); - + double alpha = atof(argv[11]); - typedef otb::Image<PixelType,Dimension> ImageType; + typedef otb::Image<PixelType, Dimension> ImageType; typedef ImageType::PixelType InputPixelType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileWriter<ImageType> WriterType; @@ -57,7 +55,7 @@ int otbSFSTexturesImageFilterTest(int argc, char * argv[]) reader->SetFileName(inName); reader->GenerateOutputInformation(); - + filter->SetSpectralThreshold(spectThresh); filter->SetSpatialThreshold(spatialThresh); filter->SetNumberOfDirections(dirNb); @@ -65,29 +63,27 @@ int otbSFSTexturesImageFilterTest(int argc, char * argv[]) filter->SetAlpha(alpha); // disable PSI texture filter->SetFeatureStatus(FilterType::PSI, false); - filter->SetInput( reader->GetOutput() ); - + filter->SetInput(reader->GetOutput()); writerLength->SetFileName(outNameLength); - writerLength->SetInput( filter->GetLengthOutput() ); + writerLength->SetInput(filter->GetLengthOutput()); writerLength->Update(); writerWidth->SetFileName(outNameWidth); - writerWidth->SetInput( filter->GetWidthOutput() ); + writerWidth->SetInput(filter->GetWidthOutput()); writerWidth->Update(); writerWMean->SetFileName(outNameWMean); - writerWMean->SetInput( filter->GetWMeanOutput() ); + writerWMean->SetInput(filter->GetWMeanOutput()); writerWMean->Update(); writerRatio->SetFileName(outNameRatio); - writerRatio->SetInput( filter->GetRatioOutput() ); + writerRatio->SetInput(filter->GetRatioOutput()); writerRatio->Update(); writerSD->SetFileName(outNameSD); - writerSD->SetInput( filter->GetSDOutput() ); + writerSD->SetInput(filter->GetSDOutput()); writerSD->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbSimplePointCountStrategyTest.cxx b/Testing/Code/FeatureExtraction/otbSimplePointCountStrategyTest.cxx index 0439c4e892..5de46e41f4 100644 --- a/Testing/Code/FeatureExtraction/otbSimplePointCountStrategyTest.cxx +++ b/Testing/Code/FeatureExtraction/otbSimplePointCountStrategyTest.cxx @@ -24,41 +24,40 @@ int otbSimplePointCountStrategyTest(int argc, char * argv[]) { - const unsigned int Dimension =2; - typedef float RealType; + const unsigned int Dimension = 2; + typedef float RealType; - typedef otb::Image<RealType,Dimension> ImageType; - typedef ImageType::PointType PointType; - typedef itk::VariableLengthVector<RealType> RealVectorType; + typedef otb::Image<RealType, Dimension> ImageType; + typedef ImageType::PointType PointType; + typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef itk::PointSet<RealVectorType,Dimension> PointSetType; - typedef PointSetType::PointsContainer PointsContainerType; - typedef ImageType::IndexType IndexType; + typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + typedef PointSetType::PointsContainer PointsContainerType; + typedef ImageType::IndexType IndexType; - typedef otb::Count<PointSetType, unsigned int ,IndexType> counterType; + typedef otb::Count<PointSetType, unsigned int, IndexType> counterType; /*pointSet de test*/ - PointSetType::Pointer pointset = PointSetType::New(); - PointsContainerType::ElementIdentifier count = 0; - PointSetType::PointType Point; + PointSetType::Pointer pointset = PointSetType::New(); + PointsContainerType::ElementIdentifier count = 0; + PointSetType::PointType Point; Point[0] = 12.14; Point[1] = 14.14; - for (int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) + { pointset->SetPoint(count, Point); count++; - }/** Fin creation pointset de test */ + } /** Fin creation pointset de test */ /*Test du filtre*/ IndexType index; index[0] = 12; index[1] = 14; unsigned int rad = 2; - counterType comptemoica; - - std::cout <<"Le resultat retourne est " <<comptemoica(pointset,rad,index)<< std::endl; + counterType comptemoica; + std::cout << "Le resultat retourne est " << comptemoica(pointset, rad, index) << std::endl; return EXIT_SUCCESS; diff --git a/Testing/Code/FeatureExtraction/otbSimplifyManyPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbSimplifyManyPathListFilter.cxx index faa85af1ac..1cbc3300f3 100644 --- a/Testing/Code/FeatureExtraction/otbSimplifyManyPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbSimplifyManyPathListFilter.cxx @@ -37,37 +37,35 @@ int otbSimplifyManyPathListFilter(int argc, char * argv[]) // PointsMatrixType MatricePoints; // PointsVectorType ListPoints; - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; typedef SimplifyPathListFilterType::InputListType PathListType; PathType::ContinuousIndexType cindex; - PathListType::Pointer InputPathList = PathListType::New(); //Generate PathList unsigned long int numberOfPaths = 10000; srand(123456); - for (unsigned long int i=0; i<numberOfPaths; ++i) - { + for (unsigned long int i = 0; i < numberOfPaths; ++i) + { PathType::Pointer path = PathType::New(); //Generate PathList - unsigned int numberOfPoints=static_cast<int>((rand()/(RAND_MAX+1.0))*90) + 10; + unsigned int numberOfPoints = static_cast<int>((rand() / (RAND_MAX + 1.0)) * 90) + 10; // std::cout << "List :" << numberOfPoints << " points" << std::endl; - cindex[0]=0; - cindex[1]=0; - for (unsigned int j = 0; j<numberOfPoints; ++j) - { - cindex[0] += (rand()/(RAND_MAX+1.0))*100 - 50; - cindex[1] += (rand()/(RAND_MAX+1.0))*100 - 50;; + cindex[0] = 0; + cindex[1] = 0; + for (unsigned int j = 0; j < numberOfPoints; ++j) + { + cindex[0] += (rand() / (RAND_MAX + 1.0)) * 100 - 50; + cindex[1] += (rand() / (RAND_MAX + 1.0)) * 100 - 50; // std::cout << "Point Index :"<<cindex[0]<<", "<<cindex[1]<<std::endl; path->AddVertex(cindex); - } + } InputPathList->PushBack(path); - } + } // Instantiating object SimplifyPathListFilterType::Pointer simplifyFilter = SimplifyPathListFilterType::New(); @@ -77,38 +75,37 @@ int otbSimplifyManyPathListFilter(int argc, char * argv[]) PathListType::Pointer OutputPathList = simplifyFilter->GetOutput(); - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; + typedef PathListType::ConstIterator PathListIteratorType; + typedef PathType::VertexListType VertexListType; typedef VertexListType::ConstIterator VertexIteratorType; std::ofstream file; file.open(outfname); - unsigned int counter = 1; + unsigned int counter = 1; PathListIteratorType pathListIt = InputPathList->Begin(); - file<<"TOLERANCE: "<<simplifyFilter->GetFunctor().GetTolerance()<< "("<<tolerance<<")"<<std::endl; + file << "TOLERANCE: " << simplifyFilter->GetFunctor().GetTolerance() << "(" << tolerance << ")" << std::endl; pathListIt = OutputPathList->Begin(); - file<<"OUTPUT list of Path "<<": "<<std::endl; - while (pathListIt!=OutputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "OUTPUT list of Path " << ": " << std::endl; + while (pathListIt != OutputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx index 817785863f..351fbd2fbd 100644 --- a/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx @@ -27,58 +27,57 @@ int otbSimplifyPathListFilter(int argc, char * argv[]) const char * outfname = argv[1]; const double tolerance = atof(argv[2]); - typedef std::vector<double> PointsVectorType; - typedef std::vector< PointsVectorType > PointsMatrixType; + typedef std::vector<double> PointsVectorType; + typedef std::vector<PointsVectorType> PointsMatrixType; PointsMatrixType MatricePoints; PointsVectorType ListPoints; int cpt = 3; ListPoints.clear(); - while ( argv[cpt] != NULL ) - { - if ( argv[cpt][0] == '|' ) + while (argv[cpt] != NULL) { - if ( (ListPoints.size()%2) != 0 ) + if (argv[cpt][0] == '|') { - itkGenericExceptionMacro(<<"Missing point in parameters !"); - } + if ((ListPoints.size() % 2) != 0) + { + itkGenericExceptionMacro(<< "Missing point in parameters !"); + } MatricePoints.push_back(ListPoints); ListPoints.clear(); - } + } else - { + { ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } + } cpt++; - } + } MatricePoints.push_back(ListPoints); const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; typedef SimplifyPathListFilterType::InputListType PathListType; PathType::ContinuousIndexType cindex; - PathListType::Pointer InputPathList = PathListType::New(); //Generate PathList - for (PointsMatrixType::iterator listpos=MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { + for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) + { PathType::Pointer path = PathType::New(); //Generate PathList - std::cout << "List "<<std::endl; - for (PointsVectorType::iterator it=(*listpos).begin(); it != (*listpos).end(); ++it) - { + std::cout << "List " << std::endl; + for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) + { cindex[0] = *it; ++it; cindex[1] = *it; - std::cout << "Point Index :"<<cindex[0]<<";"<<cindex[1]<<std::endl; + std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; path->AddVertex(cindex); - } + } InputPathList->PushBack(path); - } + } // Instantiating object SimplifyPathListFilterType::Pointer simplifyFilter = SimplifyPathListFilterType::New(); @@ -88,56 +87,55 @@ int otbSimplifyPathListFilter(int argc, char * argv[]) PathListType::Pointer OutputPathList = simplifyFilter->GetOutput(); - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; + typedef PathListType::ConstIterator PathListIteratorType; + typedef PathType::VertexListType VertexListType; typedef VertexListType::ConstIterator VertexIteratorType; std::ofstream file; file.open(outfname); - unsigned int counter = 1; + unsigned int counter = 1; PathListIteratorType pathListIt = InputPathList->Begin(); - file<<"TOLERANCE: "<<simplifyFilter->GetFunctor().GetTolerance()<< "("<<tolerance<<")"<<std::endl; - file<<"INPUT list of Path "<<": "<<std::endl; - while (pathListIt!=InputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "TOLERANCE: " << simplifyFilter->GetFunctor().GetTolerance() << "(" << tolerance << ")" << std::endl; + file << "INPUT list of Path " << ": " << std::endl; + while (pathListIt != InputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } counter = 1; pathListIt = OutputPathList->Begin(); - file<<"OUTPUT list of Path "<<": "<<std::endl; - while (pathListIt!=OutputPathList->End()) - { - file<<"Path "<<counter<<": "; + file << "OUTPUT list of Path " << ": " << std::endl; + while (pathListIt != OutputPathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbSimplifyPathListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbSimplifyPathListFilterNew.cxx index e1bf3c08f1..5449bd5a27 100644 --- a/Testing/Code/FeatureExtraction/otbSimplifyPathListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbSimplifyPathListFilterNew.cxx @@ -23,13 +23,12 @@ int otbSimplifyPathListFilterNew(int argc, char * argv[]) { - const unsigned int Dimension =2; + const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; + typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; // Instantiating object SimplifyPathListFilterType::Pointer object = SimplifyPathListFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbSqrtSpectralAngleImageFilter.cxx b/Testing/Code/FeatureExtraction/otbSqrtSpectralAngleImageFilter.cxx index 376e3af46a..db18cf6bf0 100644 --- a/Testing/Code/FeatureExtraction/otbSqrtSpectralAngleImageFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbSqrtSpectralAngleImageFilter.cxx @@ -24,25 +24,23 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbSqrtSpectralAngleImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::SqrtSpectralAngleFunctor<InputImageType::PixelType,OutputImageType::PixelType> FunctorType; - - typedef itk::UnaryFunctorImageFilter<InputImageType,OutputImageType,FunctorType> SqrtSpectralAngleImageFilterType; + typedef otb::Functor::SqrtSpectralAngleFunctor<InputImageType::PixelType, OutputImageType::PixelType> FunctorType; + typedef itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType> SqrtSpectralAngleImageFilterType; // Instantiating objects SqrtSpectralAngleImageFilterType::Pointer filter = SqrtSpectralAngleImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -51,10 +49,8 @@ int otbSqrtSpectralAngleImageFilter(int argc, char * argv[]) unsigned int redValue(::atoi(argv[5])); unsigned int nirValue(::atoi(argv[6])); - - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); InputImageType::PixelType referencePixel; referencePixel.SetSize(4); @@ -65,11 +61,10 @@ int otbSqrtSpectralAngleImageFilter(int argc, char * argv[]) filter->GetFunctor().SetReferencePixel(referencePixel); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbTextureFunctor.cxx b/Testing/Code/FeatureExtraction/otbTextureFunctor.cxx index acb29fac2c..3d9a3ecb37 100644 --- a/Testing/Code/FeatureExtraction/otbTextureFunctor.cxx +++ b/Testing/Code/FeatureExtraction/otbTextureFunctor.cxx @@ -24,18 +24,17 @@ #include "otbStreamingImageFileWriter.h" #include "otbTextureFunctors.h" - template<class TInputImage, class TOutputImage, class TFunctor> int generic_TextureFunctor(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; - typedef typename TInputImage::SizeType SizeType; - typedef typename TInputImage::OffsetType OffsetType; - typedef otb::ImageFileReader<TInputImage> ReaderType; + typedef typename TInputImage::SizeType SizeType; + typedef typename TInputImage::OffsetType OffsetType; + typedef otb::ImageFileReader<TInputImage> ReaderType; typedef otb::StreamingImageFileWriter<TOutputImage> WriterType; - + typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter<TInputImage, TOutputImage, TFunctor> FilterType; // Instantiating object @@ -64,103 +63,102 @@ int otbTextureFunctor(int argc, char * argv[]) std::string strArgv(argv[1]); argc--; argv++; - + typedef double InputPixelType; const int Dimension = 2; - typedef otb::VectorImage<InputPixelType,Dimension> ImageType; - typedef ImageType::PixelType PixelType; - typedef itk::ConstNeighborhoodIterator<ImageType> IteratorType; - - if(strArgv == "ENJ") + typedef otb::VectorImage<InputPixelType, Dimension> ImageType; + typedef ImageType::PixelType PixelType; + typedef itk::ConstNeighborhoodIterator<ImageType> IteratorType; + + if (strArgv == "ENJ") { - typedef otb::Functor::EnergyTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::EnergyTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "ENT" ) + else if (strArgv == "ENT") { - typedef otb::Functor::EntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::EntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "IMD" ) + else if (strArgv == "IMD") { - typedef otb::Functor::InverseDifferenceMomentTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::InverseDifferenceMomentTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "ASM" ) + else if (strArgv == "ASM") { - typedef otb::Functor::AngularSecondMomentumTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::AngularSecondMomentumTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "VAR" ) + else if (strArgv == "VAR") { - typedef otb::Functor::VarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::VarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "COR" ) + else if (strArgv == "COR") { - typedef otb::Functor::CorrelationTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::CorrelationTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "CON" ) + else if (strArgv == "CON") { - typedef otb::Functor::ContrastTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::ContrastTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "SAV" ) + else if (strArgv == "SAV") { - typedef otb::Functor::SumAverageTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::SumAverageTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "DEN" ) + else if (strArgv == "DEN") { - typedef otb::Functor::DifferenceEntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::DifferenceEntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "SEN" ) + else if (strArgv == "SEN") { - typedef otb::Functor::SumEntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::SumEntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "SVA" ) + else if (strArgv == "SVA") { - typedef otb::Functor::SumVarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::SumVarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "DVA" ) + else if (strArgv == "DVA") { - typedef otb::Functor::DifferenceVarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::DifferenceVarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "IC1" ) + else if (strArgv == "IC1") { - typedef otb::Functor::InformationMeasureOfCorrelation1TextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::InformationMeasureOfCorrelation1TextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "IC2" ) + else if (strArgv == "IC2") { - typedef otb::Functor::InformationMeasureOfCorrelation2TextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::InformationMeasureOfCorrelation2TextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "CSH" ) + else if (strArgv == "CSH") { - typedef otb::Functor::ClusterShadeTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::ClusterShadeTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "CPR" ) + else if (strArgv == "CPR") { - typedef otb::Functor::ClusterProminenceTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::ClusterProminenceTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "MEA" ) + else if (strArgv == "MEA") { - typedef otb::Functor::MeanTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::MeanTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureFunctor<ImageType, ImageType, FunctorType>(argc, argv)); } else { - return EXIT_FAILURE; + return EXIT_FAILURE; } - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbTextureFunctorBase.cxx b/Testing/Code/FeatureExtraction/otbTextureFunctorBase.cxx index edfd6c3c49..92b4703f8b 100644 --- a/Testing/Code/FeatureExtraction/otbTextureFunctorBase.cxx +++ b/Testing/Code/FeatureExtraction/otbTextureFunctorBase.cxx @@ -24,27 +24,25 @@ #include "otbImageFileWriter.h" #include "otbTextureFunctorBase.h" - template <class TScalarInput, class TScalarOutput> class ITK_EXPORT TextureFunctorTest : -public otb::Functor::TextureFunctorBase<TScalarInput, TScalarOutput> + public otb::Functor::TextureFunctorBase<TScalarInput, TScalarOutput> { public: TextureFunctorTest() - {}; - ~TextureFunctorTest(){}; + {}; + ~TextureFunctorTest(){} + + typedef itk::Neighborhood<TScalarInput, 2> NeighborhoodType; - typedef itk::Neighborhood<TScalarInput, 2> NeighborhoodType; - - virtual double ComputeOverSingleChannel(const NeighborhoodType &neigh, const NeighborhoodType &neighOff) + virtual double ComputeOverSingleChannel(const NeighborhoodType& neigh, const NeighborhoodType& neighOff) { double out = neigh.GetCenterValue(); - + return out; } }; - int otbTextureFunctorBase(int argc, char * argv[]) { const char * inputFileName = argv[1]; @@ -52,20 +50,21 @@ int otbTextureFunctorBase(int argc, char * argv[]) typedef double InputPixelType; const int Dimension = 2; - typedef otb::VectorImage<InputPixelType,Dimension> ImageType; - typedef ImageType::PixelType PixelType; - typedef ImageType::OffsetType OffsetType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::VectorImage<InputPixelType, Dimension> ImageType; + typedef ImageType::PixelType PixelType; + typedef ImageType::OffsetType OffsetType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::ConstNeighborhoodIterator<ImageType> IterType;; - typedef TextureFunctorTest<InputPixelType, InputPixelType> FunctorType; - typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter<ImageType, ImageType, FunctorType> UnaryFunctorNeighborhoodImageFilterType; + typedef itk::ConstNeighborhoodIterator<ImageType> IterType; + typedef TextureFunctorTest<InputPixelType, InputPixelType> FunctorType; + typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter<ImageType, ImageType, + FunctorType> UnaryFunctorNeighborhoodImageFilterType; // Instantiating object UnaryFunctorNeighborhoodImageFilterType::Pointer object = UnaryFunctorNeighborhoodImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -80,6 +79,5 @@ int otbTextureFunctorBase(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbTextureImageFunction.cxx b/Testing/Code/FeatureExtraction/otbTextureImageFunction.cxx index 8fc440736c..02660dab9e 100644 --- a/Testing/Code/FeatureExtraction/otbTextureImageFunction.cxx +++ b/Testing/Code/FeatureExtraction/otbTextureImageFunction.cxx @@ -27,19 +27,18 @@ #include "otbTextureFunctors.h" - template<class TInputImage, class TOutputImage, class TFunctor> int generic_TextureImageFunction(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; - typedef typename TInputImage::SizeType SizeType; - typedef typename TInputImage::OffsetType OffsetType; - typedef otb::ImageFileReader<TInputImage> ReaderType; + typedef typename TInputImage::SizeType SizeType; + typedef typename TInputImage::OffsetType OffsetType; + typedef otb::ImageFileReader<TInputImage> ReaderType; typedef otb::StreamingImageFileWriter<TOutputImage> WriterType; - typedef otb::TextureImageFunction<TInputImage, TFunctor> FunctionType; + typedef otb::TextureImageFunction<TInputImage, TFunctor> FunctionType; typedef otb::FunctionWithNeighborhoodToImageFilter<TInputImage, TOutputImage, FunctionType> FilterType; typename FilterType::Pointer filter = FilterType::New(); @@ -63,7 +62,6 @@ int generic_TextureImageFunction(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } @@ -72,104 +70,102 @@ int otbTextureImageFunction(int argc, char * argv[]) std::string strArgv(argv[1]); argc--; argv++; - typedef double InputPixelType; const int Dimension = 2; - typedef otb::Image<InputPixelType,Dimension> ImageType; - typedef itk::VariableLengthVector<double> VectorType; + typedef otb::Image<InputPixelType, Dimension> ImageType; + typedef itk::VariableLengthVector<double> VectorType; typedef itk::ConstNeighborhoodIterator<ImageType> IteratorType; - - - if(strArgv == "ENJ") + + if (strArgv == "ENJ") { - typedef otb::Functor::EnergyTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::EnergyTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "ENT" ) + else if (strArgv == "ENT") { - typedef otb::Functor::EntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::EntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "IMD" ) + else if (strArgv == "IMD") { - typedef otb::Functor::InverseDifferenceMomentTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::InverseDifferenceMomentTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "ASM" ) + else if (strArgv == "ASM") { - typedef otb::Functor::AngularSecondMomentumTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::AngularSecondMomentumTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "VAR" ) + else if (strArgv == "VAR") { - typedef otb::Functor::VarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::VarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "COR" ) + else if (strArgv == "COR") { - typedef otb::Functor::CorrelationTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::CorrelationTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "CON" ) + else if (strArgv == "CON") { - typedef otb::Functor::ContrastTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::ContrastTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "SAV" ) + else if (strArgv == "SAV") { - typedef otb::Functor::SumAverageTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::SumAverageTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "DEN" ) + else if (strArgv == "DEN") { - typedef otb::Functor::DifferenceEntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::DifferenceEntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "SEN" ) + else if (strArgv == "SEN") { - typedef otb::Functor::SumEntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::SumEntropyTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "SVA" ) + else if (strArgv == "SVA") { - typedef otb::Functor::SumVarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::SumVarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "DVA" ) + else if (strArgv == "DVA") { - typedef otb::Functor::DifferenceVarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::DifferenceVarianceTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "IC1" ) + else if (strArgv == "IC1") { - typedef otb::Functor::InformationMeasureOfCorrelation1TextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::InformationMeasureOfCorrelation1TextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "IC2" ) + else if (strArgv == "IC2") { - typedef otb::Functor::InformationMeasureOfCorrelation2TextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::InformationMeasureOfCorrelation2TextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "CSH" ) + else if (strArgv == "CSH") { - typedef otb::Functor::ClusterShadeTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::ClusterShadeTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "CPR" ) + else if (strArgv == "CPR") { - typedef otb::Functor::ClusterProminenceTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::ClusterProminenceTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } - else if ( strArgv == "MEA" ) + else if (strArgv == "MEA") { - typedef otb::Functor::MeanTextureFunctor<InputPixelType, InputPixelType> FunctorType; - return( generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc,argv) ); + typedef otb::Functor::MeanTextureFunctor<InputPixelType, InputPixelType> FunctorType; + return (generic_TextureImageFunction<ImageType, ImageType, FunctorType>(argc, argv)); } else { - return EXIT_FAILURE; + return EXIT_FAILURE; } - + return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetFilterNew.cxx b/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetFilterNew.cxx index 6a40265780..8630d06d43 100644 --- a/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetFilterNew.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include "otbThresholdImageToPointSetFilter.h" @@ -29,20 +28,16 @@ #include <iostream> - -int otbThresholdImageToPointSetFilterNew( int argc, char* argv[] ) +int otbThresholdImageToPointSetFilterNew(int argc, char* argv[]) { - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; typedef unsigned char PixelType; typedef otb::Image<PixelType, Dimension> ImageType; typedef itk::PointSet<PixelType, Dimension> PointSetType; - typedef otb::ThresholdImageToPointSetFilter< ImageType, PointSetType > FilterThresholdType; - + typedef otb::ThresholdImageToPointSetFilter<ImageType, PointSetType> FilterThresholdType; FilterThresholdType::Pointer filterThreshold = FilterThresholdType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetTest.cxx b/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetTest.cxx index ba601929fc..35e0da1e68 100644 --- a/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetTest.cxx +++ b/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetTest.cxx @@ -27,56 +27,54 @@ #include "otbThresholdImageToPointSetFilter.h" #include "itkPointSet.h" -int otbThresholdImageToPointSetTest( int argc, char * argv[] ) +int otbThresholdImageToPointSetTest(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension> InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef itk::PointSet<InputPixelType,Dimension> PointSetType; - typedef otb::ThresholdImageToPointSetFilter<InputImageType,PointSetType> FunctionType; - typedef PointSetType::PointType PointType; - typedef FunctionType::InputPixelType InputPixelType; - typedef FunctionType::OutputPointSetType OutputPointSetType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef itk::PointSet<InputPixelType, Dimension> PointSetType; + typedef otb::ThresholdImageToPointSetFilter<InputImageType, PointSetType> FunctionType; + typedef PointSetType::PointType PointType; + typedef FunctionType::InputPixelType InputPixelType; + typedef FunctionType::OutputPointSetType OutputPointSetType; - InputPixelType LowerThreshold((InputPixelType)::atoi(argv[3])); - InputPixelType UpperThreshold((InputPixelType)::atoi(argv[4])); + InputPixelType LowerThreshold((InputPixelType) ::atoi(argv[3])); + InputPixelType UpperThreshold((InputPixelType) ::atoi(argv[4])); ReaderType::Pointer reader = ReaderType::New(); FunctionType::Pointer function = FunctionType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); - function->SetInput( 0,reader->GetOutput() ); - function->SetLowerThreshold( LowerThreshold ); - function->SetUpperThreshold( UpperThreshold ); + function->SetInput(0, reader->GetOutput()); + function->SetLowerThreshold(LowerThreshold); + function->SetUpperThreshold(UpperThreshold); function->Update(); OutputPointSetType * pointList = function->GetOutput(); std::ofstream file; file.open(outputFilename); - unsigned long NbPoints = pointList->GetNumberOfPoints(); - file << "NbPoints : " << NbPoints <<std::endl; + unsigned long NbPoints = pointList->GetNumberOfPoints(); + file << "NbPoints : " << NbPoints << std::endl; - PointType CoordPoint; + PointType CoordPoint; //Initialization CoordPoint.Fill(0); for (unsigned long i = 0; i < NbPoints; i++) - { - pointList->GetPoint(i,&CoordPoint); - file << i+1 <<"/" << NbPoints<<" : " << CoordPoint[0] << " , "<<CoordPoint[1]<< std::endl; - } + { + pointList->GetPoint(i, &CoordPoint); + file << i + 1 << "/" << NbPoints << " : " << CoordPoint[0] << " , " << CoordPoint[1] << std::endl; + } file.close(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbTouziEdgeDetector.cxx b/Testing/Code/FeatureExtraction/otbTouziEdgeDetector.cxx index 72f49609c1..2051a2d998 100644 --- a/Testing/Code/FeatureExtraction/otbTouziEdgeDetector.cxx +++ b/Testing/Code/FeatureExtraction/otbTouziEdgeDetector.cxx @@ -29,25 +29,24 @@ #include "otbImageFileWriter.h" #include "otbTouziEdgeDetectorImageFilter.h" - -int otbTouziEdgeDetector( int argc, char* argv[] ) +int otbTouziEdgeDetector(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int RadiusX((unsigned int)::atoi(argv[3])); + unsigned int RadiusX((unsigned int) ::atoi(argv[3])); - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::TouziEdgeDetectorImageFilter< InputImageType,OutputImageType > FilterType; + typedef otb::TouziEdgeDetectorImageFilter<InputImageType, OutputImageType> FilterType; FilterType::SizeType Radius; Radius[0] = RadiusX; @@ -55,21 +54,18 @@ int otbTouziEdgeDetector( int argc, char* argv[] ) FilterType::Pointer filterTouzi = FilterType::New(); - filterTouzi->SetRadius( Radius ); + filterTouzi->SetRadius(Radius); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - filterTouzi->SetInput( reader->GetOutput() ); - writer->SetInput( filterTouzi->GetOutput() ); + filterTouzi->SetInput(reader->GetOutput()); + writer->SetInput(filterTouzi->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorDirection.cxx b/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorDirection.cxx index f080c31104..0361dbe707 100644 --- a/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorDirection.cxx +++ b/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorDirection.cxx @@ -29,25 +29,24 @@ #include "otbImageFileWriter.h" #include "otbTouziEdgeDetectorImageFilter.h" - -int otbTouziEdgeDetectorDirection( int argc, char* argv[] ) +int otbTouziEdgeDetectorDirection(int argc, char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - unsigned int RadiusX((unsigned int)::atoi(argv[3])); + unsigned int RadiusX((unsigned int) ::atoi(argv[3])); - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::TouziEdgeDetectorImageFilter< InputImageType,OutputImageType > FilterType; + typedef otb::TouziEdgeDetectorImageFilter<InputImageType, OutputImageType> FilterType; FilterType::SizeType Radius; Radius[0] = RadiusX; @@ -55,21 +54,18 @@ int otbTouziEdgeDetectorDirection( int argc, char* argv[] ) FilterType::Pointer filterTouzi = FilterType::New(); - filterTouzi->SetRadius( Radius ); + filterTouzi->SetRadius(Radius); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - filterTouzi->SetInput( reader->GetOutput() ); - writer->SetInput( filterTouzi->GetOutputDirection() ); + filterTouzi->SetInput(reader->GetOutput()); + writer->SetInput(filterTouzi->GetOutputDirection()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorNew.cxx b/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorNew.cxx index 3b1e91721d..9113f09360 100644 --- a/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorNew.cxx +++ b/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorNew.cxx @@ -26,23 +26,18 @@ #include "otbTouziEdgeDetectorImageFilter.h" - -int otbTouziEdgeDetectorNew( int argc, char* argv[] ) +int otbTouziEdgeDetectorNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; - - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef unsigned char InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::TouziEdgeDetectorImageFilter< InputImageType,OutputImageType > FilterType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::TouziEdgeDetectorImageFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filterTouzi = FilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilter.cxx b/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilter.cxx index 0c01934b33..ef7cbee414 100644 --- a/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilter.cxx @@ -17,51 +17,47 @@ =========================================================================*/ #include "itkExceptionObject.h" - #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" #include "otbUrbanAreaDetectionImageFilter.h" - int otbUrbanAreaDetectionImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputVectorImageType; - typedef otb::Image<unsigned char,Dimension> OutputImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputVectorImageType; + typedef otb::Image<unsigned char, Dimension> OutputImageType; - typedef otb::Image<double,Dimension> SingleImageType; + typedef otb::Image<double, Dimension> SingleImageType; + typedef otb::ImageFileReader<InputVectorImageType> ReaderType; - typedef otb::ImageFileReader<InputVectorImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - typedef otb::UrbanAreaDetectionImageFilter< InputVectorImageType, - OutputImageType > UrbanAreaDetectionFilterType; + typedef otb::UrbanAreaDetectionImageFilter<InputVectorImageType, + OutputImageType> UrbanAreaDetectionFilterType; // Instantiating objects UrbanAreaDetectionFilterType::Pointer filter = UrbanAreaDetectionFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - filter->SetInput( reader->GetOutput() ); - filter->SetRedIndex( ::atoi(argv[3])); - filter->SetGreenIndex( ::atoi(argv[4])); - filter->SetNIRIndex( ::atoi(argv[5])); - filter->SetThresholdValue( ::atof(argv[6])); - filter->SetThresholdDensity( ::atof(argv[7])); + filter->SetInput(reader->GetOutput()); + filter->SetRedIndex(::atoi(argv[3])); + filter->SetGreenIndex(::atoi(argv[4])); + filter->SetNIRIndex(::atoi(argv[5])); + filter->SetThresholdValue(::atof(argv[6])); + filter->SetThresholdDensity(::atof(argv[7])); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilterNew.cxx b/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilterNew.cxx index daadde6815..c0dbd5acba 100644 --- a/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilterNew.cxx @@ -20,21 +20,19 @@ #include "otbVectorImage.h" #include "otbUrbanAreaDetectionImageFilter.h" - int otbUrbanAreaDetectionImageFilterNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputVectorImageType; - typedef otb::Image<unsigned char,Dimension> OutputImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputVectorImageType; + typedef otb::Image<unsigned char, Dimension> OutputImageType; - typedef otb::UrbanAreaDetectionImageFilter< InputVectorImageType, - OutputImageType > UrbanAreaDetectionFilterType; + typedef otb::UrbanAreaDetectionImageFilter<InputVectorImageType, + OutputImageType> UrbanAreaDetectionFilterType; // Instantiating objects UrbanAreaDetectionFilterType::Pointer filter = UrbanAreaDetectionFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbVectorizationPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbVectorizationPathListFilter.cxx index 1fbbe4b896..8f0bc942b0 100644 --- a/Testing/Code/FeatureExtraction/otbVectorizationPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbVectorizationPathListFilter.cxx @@ -34,23 +34,23 @@ int otbVectorizationPathListFilter(int argc, char * argv[]) const double thresh = atof(argv[5]); const unsigned int Dimension = 2; - typedef double PixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::DrawPathListFilter<OutputImageType,PathType,OutputImageType> DrawFilterType; - typedef otb::VectorizationPathListFilter<ImageType,ImageType,PathType> VectorizationPathListFilterType; - typedef VectorizationPathListFilterType::OutputPathListType PathListType; - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; - typedef VertexListType::ConstIterator VertexIteratorType; + typedef double PixelType; + typedef unsigned char OutputPixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::DrawPathListFilter<OutputImageType, PathType, OutputImageType> DrawFilterType; + typedef otb::VectorizationPathListFilter<ImageType, ImageType, PathType> VectorizationPathListFilterType; + typedef VectorizationPathListFilterType::OutputPathListType PathListType; + typedef PathListType::ConstIterator PathListIteratorType; + typedef PathType::VertexListType VertexListType; + typedef VertexListType::ConstIterator VertexIteratorType; // Instantiating objects VectorizationPathListFilterType::Pointer filter = VectorizationPathListFilterType::New(); - ReaderType::Pointer modReader = ReaderType::New(); - ReaderType::Pointer dirReader = ReaderType::New(); + ReaderType::Pointer modReader = ReaderType::New(); + ReaderType::Pointer dirReader = ReaderType::New(); modReader->SetFileName(modfname); dirReader->SetFileName(dirfname); @@ -61,29 +61,29 @@ int otbVectorizationPathListFilter(int argc, char * argv[]) filter->Update(); PathListType::Pointer pathList = filter->GetOutput(); - PathListIteratorType pathListIt = pathList->Begin(); + PathListIteratorType pathListIt = pathList->Begin(); std::ofstream file; file.open(outfname); unsigned int counter = 0; - while (pathListIt!=pathList->End()) - { - file<<"Path "<<counter<<": "; + while (pathListIt != pathList->End()) + { + file << "Path " << counter << ": "; for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt!=pathListIt.Get()->GetVertexList()->End(); + vIt != pathListIt.Get()->GetVertexList()->End(); ++vIt) - { - if (vIt!=pathListIt.Get()->GetVertexList()->Begin()) { - file<<", "; + if (vIt != pathListIt.Get()->GetVertexList()->Begin()) + { + file << ", "; + } + file << vIt.Value(); } - file<<vIt.Value(); - } - file<<std::endl; + file << std::endl; ++pathListIt; ++counter; - } + } file.close(); OutputImageType::Pointer output = OutputImageType::New(); @@ -101,6 +101,5 @@ int otbVectorizationPathListFilter(int argc, char * argv[]) writer->SetInput(drawer->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/FeatureExtraction/otbVectorizationPathListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbVectorizationPathListFilterNew.cxx index d8df801968..fc8ce65e70 100644 --- a/Testing/Code/FeatureExtraction/otbVectorizationPathListFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbVectorizationPathListFilterNew.cxx @@ -23,10 +23,10 @@ int otbVectorizationPathListFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::VectorizationPathListFilter<ImageType,ImageType,PathType> VectorizationPathListFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::VectorizationPathListFilter<ImageType, ImageType, PathType> VectorizationPathListFilterType; // Instantiating object VectorizationPathListFilterType::Pointer object = VectorizationPathListFilterType::New(); diff --git a/Testing/Code/Fusion/otbBayesianFusionFilter.cxx b/Testing/Code/Fusion/otbBayesianFusionFilter.cxx index f426021e82..cd3260d105 100644 --- a/Testing/Code/Fusion/otbBayesianFusionFilter.cxx +++ b/Testing/Code/Fusion/otbBayesianFusionFilter.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" @@ -25,7 +24,7 @@ #include "otbBayesianFusionFilter.h" -int otbBayesianFusionFilter( int argc, char * argv[] ) +int otbBayesianFusionFilter(int argc, char * argv[]) { const char * multispect = argv[1]; const char * multispectinterp = argv[2]; @@ -35,19 +34,25 @@ int otbBayesianFusionFilter( int argc, char * argv[] ) const unsigned int Dimension = 2; typedef double PixelType; - - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::Image<PixelType,Dimension> PanchroImageType; - typedef otb::ImageFileReader<VectorImageType> VectorReaderType; - typedef otb::ImageFileReader<PanchroImageType> ImageReaderType; - typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType; + typedef otb::VectorImage<PixelType, + Dimension> + VectorImageType; + typedef otb::Image<PixelType, + Dimension> + PanchroImageType; + typedef otb::ImageFileReader<VectorImageType> + VectorReaderType; + typedef otb::ImageFileReader<PanchroImageType> + ImageReaderType; + typedef otb::StreamingImageFileWriter<VectorImageType> + VectorImageWriterType; typedef otb::BayesianFusionFilter<VectorImageType, VectorImageType, PanchroImageType, VectorImageType> FilterType; - VectorReaderType::Pointer multiSpectReader = VectorReaderType::New(); - VectorReaderType::Pointer multiSpectInterpReader = VectorReaderType::New(); - ImageReaderType::Pointer panchroReader = ImageReaderType::New(); - FilterType::Pointer filter = FilterType::New(); - VectorImageWriterType::Pointer writer = VectorImageWriterType::New(); + VectorReaderType::Pointer multiSpectReader = VectorReaderType::New(); + VectorReaderType::Pointer multiSpectInterpReader = VectorReaderType::New(); + ImageReaderType::Pointer panchroReader = ImageReaderType::New(); + FilterType::Pointer filter = FilterType::New(); + VectorImageWriterType::Pointer writer = VectorImageWriterType::New(); multiSpectReader->SetFileName(multispect); multiSpectInterpReader->SetFileName(multispectinterp); @@ -56,12 +61,9 @@ int otbBayesianFusionFilter( int argc, char * argv[] ) filter->SetMultiSpect(multiSpectReader->GetOutput()); filter->SetMultiSpectInterp(multiSpectInterpReader->GetOutput()); filter->SetPanchro(panchroReader->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->SetFileName(output); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Fusion/otbBayesianFusionFilterNew.cxx b/Testing/Code/Fusion/otbBayesianFusionFilterNew.cxx index f61dd1282b..389838a4bb 100644 --- a/Testing/Code/Fusion/otbBayesianFusionFilterNew.cxx +++ b/Testing/Code/Fusion/otbBayesianFusionFilterNew.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -25,22 +24,24 @@ #include "otbBayesianFusionFilter.h" -int otbBayesianFusionFilterNew( int argc, char * argv[] ) +int otbBayesianFusionFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; - - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::Image<PixelType,Dimension> PanchroImageType; - typedef otb::ImageFileReader<VectorImageType> VectorReaderType; - typedef otb::ImageFileReader<PanchroImageType> ImageReaderType; + typedef otb::VectorImage<PixelType, + Dimension> + VectorImageType; + typedef otb::Image<PixelType, + Dimension> + PanchroImageType; + typedef otb::ImageFileReader<VectorImageType> + VectorReaderType; + typedef otb::ImageFileReader<PanchroImageType> + ImageReaderType; typedef otb::BayesianFusionFilter<VectorImageType, VectorImageType, PanchroImageType, VectorImageType> FilterType; - FilterType::Pointer filter = FilterType::New(); - + FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Fusion/otbFusionImageBaseNew.cxx b/Testing/Code/Fusion/otbFusionImageBaseNew.cxx index a4ef8406cc..ea61be3a03 100644 --- a/Testing/Code/Fusion/otbFusionImageBaseNew.cxx +++ b/Testing/Code/Fusion/otbFusionImageBaseNew.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImage.h" #include "otbVectorImage.h" @@ -28,43 +27,40 @@ template <class TInputMultiSpectral, class TInputMultiSpectralInterp, class TInp class NewFunctorTest { public: - NewFunctorTest() {}; - ~NewFunctorTest() {}; + NewFunctorTest() {} + ~NewFunctorTest() {} - inline TOutput operator() (const TInputMultiSpectral & A, const TInputMultiSpectralInterp & B, const TInputPanchro & C) + inline TOutput operator ()(const TInputMultiSpectral& A, const TInputMultiSpectralInterp& B, const TInputPanchro& C) { - return(static_cast<TOutput>(A[0]) + static_cast<TOutput>(B[0]) + static_cast<TOutput>(C)); + return (static_cast<TOutput>(A[0]) + static_cast<TOutput>(B[0]) + static_cast<TOutput>(C)); } }; } -int otbFusionImageBaseNew( int argc, char * argv[] ) +int otbFusionImageBaseNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputPanchroImageType; - typedef otb::VectorImage<InputPixelType,Dimension> InputMultiSpectralImageType; - typedef otb::VectorImage<InputPixelType,Dimension> InputMultiSpectralInterpImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputPanchroImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputMultiSpectralImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputMultiSpectralInterpImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; typedef otb::FusionImageBase<InputMultiSpectralImageType, - InputMultiSpectralInterpImageType, - InputPanchroImageType, - OutputImageType, - Functor::NewFunctorTest<InputMultiSpectralImageType::PixelType, - InputMultiSpectralInterpImageType::PixelType, - InputPanchroImageType::PixelType, - OutputImageType::PixelType> - > FusionImageBaseType; + InputMultiSpectralInterpImageType, + InputPanchroImageType, + OutputImageType, + Functor::NewFunctorTest<InputMultiSpectralImageType::PixelType, + InputMultiSpectralInterpImageType::PixelType, + InputPanchroImageType::PixelType, + OutputImageType::PixelType> + > FusionImageBaseType; // Instantiation FusionImageBaseType::Pointer base = FusionImageBaseType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Fusion/otbFusionTests1.cxx b/Testing/Code/Fusion/otbFusionTests1.cxx index e1f9d3fdff..66b7cabc79 100644 --- a/Testing/Code/Fusion/otbFusionTests1.cxx +++ b/Testing/Code/Fusion/otbFusionTests1.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbBayesianFusionFilterNew); diff --git a/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx b/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx index 81605cda78..852783a1ec 100644 --- a/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx +++ b/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" @@ -25,7 +24,7 @@ #include "otbSimpleRcsPanSharpeningFusionImageFilter.h" -int otbSimpleRcsPanSharpeningFusionImageFilter( int argc, char * argv[] ) +int otbSimpleRcsPanSharpeningFusionImageFilter(int argc, char * argv[]) { const char * panchro = argv[1]; const char * multispect = argv[2]; @@ -34,28 +33,27 @@ int otbSimpleRcsPanSharpeningFusionImageFilter( int argc, char * argv[] ) const unsigned int Dimension = 2; typedef double PixelType; - - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::Image<PixelType,Dimension> PanchroImageType; - typedef otb::ImageFileReader<VectorImageType> VectorReaderType; - typedef otb::ImageFileReader<PanchroImageType> ImageReaderType; - typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> PanchroImageType; + typedef otb::ImageFileReader<VectorImageType> VectorReaderType; + typedef otb::ImageFileReader<PanchroImageType> ImageReaderType; + typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType; typedef otb::SimpleRcsPanSharpeningFusionImageFilter <PanchroImageType, VectorImageType, VectorImageType> FilterType; - VectorReaderType::Pointer multiSpectReader = VectorReaderType::New(); - ImageReaderType::Pointer panchroReader = ImageReaderType::New(); - FilterType::Pointer filter = FilterType::New(); - VectorImageWriterType::Pointer writer = VectorImageWriterType::New(); + VectorReaderType::Pointer multiSpectReader = VectorReaderType::New(); + ImageReaderType::Pointer panchroReader = ImageReaderType::New(); + FilterType::Pointer filter = FilterType::New(); + VectorImageWriterType::Pointer writer = VectorImageWriterType::New(); multiSpectReader->SetFileName(multispect); panchroReader->SetFileName(panchro); PanchroImageType::SizeType radius; - radius[0]=3; - radius[1]=3; - itk::Array< double > filterCoeffs; - filterCoeffs.SetSize((2*radius[0]+1)*(2*radius[1]+1)); + radius[0] = 3; + radius[1] = 3; + itk::Array<double> filterCoeffs; + filterCoeffs.SetSize((2 * radius[0] + 1) * (2 * radius[1] + 1)); // double filterTmp[] = { // 0.00390625, 0.0078125, 0.0117188, 0.015625, 0.0117188, 0.0078125, 0.00390625, @@ -74,12 +72,9 @@ int otbSimpleRcsPanSharpeningFusionImageFilter( int argc, char * argv[] ) filter->SetPanInput(panchroReader->GetOutput()); filter->SetRadius(radius); filter->SetFilter(filterCoeffs); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->SetFileName(output); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx b/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx index dfec906347..b1cfd9afef 100644 --- a/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx +++ b/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx @@ -16,7 +16,6 @@ =========================================================================*/ - #include "itkExceptionObject.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -25,23 +24,19 @@ #include "otbSimpleRcsPanSharpeningFusionImageFilter.h" -int otbSimpleRcsPanSharpeningFusionImageFilterNew( int argc, char * argv[] ) +int otbSimpleRcsPanSharpeningFusionImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; - - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::Image<PixelType,Dimension> PanchroImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::Image<PixelType, Dimension> PanchroImageType; typedef otb::ImageFileReader<VectorImageType> VectorReaderType; typedef otb::ImageFileReader<PanchroImageType> ImageReaderType; typedef otb::SimpleRcsPanSharpeningFusionImageFilter <PanchroImageType, VectorImageType, VectorImageType> FilterType; - FilterType::Pointer filter = FilterType::New(); - + FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorAccessors.cxx b/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorAccessors.cxx index f7a2293010..8589cf09bb 100644 --- a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorAccessors.cxx +++ b/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorAccessors.cxx @@ -30,26 +30,21 @@ int otbPostGISCreateTableTransactorAccessors(int argc, char * argv[]) unsigned short dimension = 2; - myTransactor.SetDimension( dimension ); + myTransactor.SetDimension(dimension); - if( dimension != myTransactor.GetDimension() ) - return EXIT_FAILURE; + if (dimension != myTransactor.GetDimension()) return EXIT_FAILURE; std::string name = "mytable"; - myTransactor.SetTableName( name ); - - if( name != myTransactor.GetTableName() ) - return EXIT_FAILURE; + myTransactor.SetTableName(name); + if (name != myTransactor.GetTableName()) return EXIT_FAILURE; int srid = -1; - myTransactor.SetSRID( srid ); - - if( srid != myTransactor.GetSRID() ) - return EXIT_FAILURE; + myTransactor.SetSRID(srid); + if (srid != myTransactor.GetSRID()) return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorCreate.cxx b/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorCreate.cxx index 6740335607..0e394f5dab 100644 --- a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorCreate.cxx +++ b/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorCreate.cxx @@ -34,35 +34,34 @@ int otbPostGISCreateTableTransactorCreate(int argc, char * argv[]) TransactorType myTransactor; unsigned short dimension = 2; - myTransactor.SetDimension( dimension ); + myTransactor.SetDimension(dimension); std::string name = "mytable"; - myTransactor.SetTableName( name ); + myTransactor.SetTableName(name); int srid = -1; - myTransactor.SetSRID( srid ); + myTransactor.SetSRID(srid); - myTransactor.SetRemoveExistingTable( true ); + myTransactor.SetRemoveExistingTable(true); const std::string hostName = argv[1]; const std::string dbName = argv[2]; const std::string userName = argv[3]; const std::string userPassword = argv[4]; - typedef otb::PostGISConnectionImplementation GISConnectionType; //Instantiation GISConnectionType::Pointer connection = GISConnectionType::New(); - connection->SetHost( hostName ); - connection->SetDBName( dbName ); - connection->SetUser( userName ); - connection->SetPassword( userPassword ); + connection->SetHost(hostName); + connection->SetDBName(dbName); + connection->SetUser(userName); + connection->SetPassword(userPassword); connection->ConnectToDB(); - connection->PerformTransaction( myTransactor ); + connection->PerformTransaction(myTransactor); return EXIT_SUCCESS; } diff --git a/Testing/Code/Gui/otbFltkFilterWatcher.cxx b/Testing/Code/Gui/otbFltkFilterWatcher.cxx index f6a36a6501..8134852111 100644 --- a/Testing/Code/Gui/otbFltkFilterWatcher.cxx +++ b/Testing/Code/Gui/otbFltkFilterWatcher.cxx @@ -21,19 +21,18 @@ #include "otbImage.h" #include "itkGradientMagnitudeImageFilter.h" - int otbFltkFilterWatcher(int argc, char * argv[]) { const char * infname = argv[1]; - typedef otb::Image<char,2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<char, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef itk::GradientMagnitudeImageFilter<ImageType, ImageType> FilterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); FilterType::Pointer gradient = FilterType::New(); gradient->SetInput(reader->GetOutput()); - otb::FltkFilterWatcher watcher(gradient,0,0,200,20,"Gradient"); + otb::FltkFilterWatcher watcher(gradient, 0, 0, 200, 20, "Gradient"); gradient->Update(); return EXIT_SUCCESS; } diff --git a/Testing/Code/Gui/otbFltkWriterWatcher.cxx b/Testing/Code/Gui/otbFltkWriterWatcher.cxx index 1cbe7fef4e..5b9c9931d1 100644 --- a/Testing/Code/Gui/otbFltkWriterWatcher.cxx +++ b/Testing/Code/Gui/otbFltkWriterWatcher.cxx @@ -26,17 +26,17 @@ int otbFltkWriterWatcher(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; + const char * infname = argv[1]; + const char * outfname = argv[2]; const unsigned int nbsd = atoi(argv[3]); const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef itk::GradientMagnitudeImageFilter<ImageType, ImageType> FilterType; - typedef otb::StreamingImageFileWriter<ImageType> StreamingWriterType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::StreamingImageFileWriter<ImageType> StreamingWriterType; + typedef otb::ImageFileWriter<ImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); @@ -50,14 +50,14 @@ int otbFltkWriterWatcher(int argc, char * argv[]) writer1->SetInput(gradient->GetOutput()); writer1->SetFileName(outfname); - otb::FltkWriterWatcher watcher1(writer1,0,0,200,40, "Gradient (streaming)"); + otb::FltkWriterWatcher watcher1(writer1, 0, 0, 200, 40, "Gradient (streaming)"); writer1->Update(); WriterType::Pointer writer2 = WriterType::New(); writer2->SetInput(gradient->GetOutput()); writer2->SetFileName(outfname); - otb::FltkWriterWatcher watcher2(writer2,0,0,200,40, "Gradient (non streaming)"); + otb::FltkWriterWatcher watcher2(writer2, 0, 0, 200, 40, "Gradient (non streaming)"); writer2->Update(); return EXIT_SUCCESS; diff --git a/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx b/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx index a7d419ed1d..173d566de9 100644 --- a/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx @@ -27,12 +27,12 @@ int otbBSQImageIOTestCanRead(int argc, char* argv[]) { otb::BSQImageIO::Pointer lBSQImageIO = otb::BSQImageIO::New(); - bool lCanRead = lBSQImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::BSQImageIO : impossible d'ouvrir l'image BSQ "<<argv[1]<<"."<<std::endl; + bool lCanRead = lBSQImageIO->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::BSQImageIO : impossible d'ouvrir l'image BSQ " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx b/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx index 7685dcdfd9..de6811a9e3 100644 --- a/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx @@ -27,12 +27,12 @@ int otbBSQImageIOTestCanWrite(int argc, char* argv[]) { otb::BSQImageIO::Pointer lBSQImageIO = otb::BSQImageIO::New(); - bool lCanRead = lBSQImageIO->CanWriteFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::L'image "<<argv[1]<<" n'est pas une image BSQ."<<std::endl; + bool lCanRead = lBSQImageIO->CanWriteFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::L'image " << argv[1] << " n'est pas une image BSQ." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbCoordinateToNameTest.cxx b/Testing/Code/IO/otbCoordinateToNameTest.cxx index 6e433447e9..dac0f15e8b 100644 --- a/Testing/Code/IO/otbCoordinateToNameTest.cxx +++ b/Testing/Code/IO/otbCoordinateToNameTest.cxx @@ -25,16 +25,16 @@ #include "otbCoordinateToName.h" -int otbCoordinateToNameTest( int argc, char* argv[] ) +int otbCoordinateToNameTest(int argc, char* argv[]) { if (argc < 4) - { - std::cout << argv[0] <<" <lon> <lat> <outputfile>" + { + std::cout << argv[0] << " <lon> <lat> <outputfile>" << std::endl; return EXIT_FAILURE; - } + } const char * outFileName = argv[3]; @@ -43,16 +43,16 @@ int otbCoordinateToNameTest( int argc, char* argv[] ) conv->SetLat(atof(argv[2])); if ((argc > 4) && atoi(argv[4]) == 1) - { + { conv->MultithreadOn(); conv->Evaluate(); - OpenThreads::Thread::microSleep(10000000);//Make sure that the web request has the time to complete - } + OpenThreads::Thread::microSleep(10000000); //Make sure that the web request has the time to complete + } else - { + { conv->MultithreadOff(); conv->Evaluate(); - } + } std::string name = conv->GetPlaceName(); std::string country = conv->GetCountryName(); diff --git a/Testing/Code/IO/otbDEMHandlerNew.cxx b/Testing/Code/IO/otbDEMHandlerNew.cxx index 8ac6c0b07f..8b8f6cc264 100644 --- a/Testing/Code/IO/otbDEMHandlerNew.cxx +++ b/Testing/Code/IO/otbDEMHandlerNew.cxx @@ -23,12 +23,11 @@ int otbDEMHandlerNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::Image<unsigned char,Dimension> ImageType; + typedef otb::Image<unsigned char, Dimension> ImageType; typedef otb::DEMHandler DEMHandlerType; // Instantiating object DEMHandlerType::Pointer object = DEMHandlerType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMHandlerTest.cxx b/Testing/Code/IO/otbDEMHandlerTest.cxx index bf0f71316a..06e80cff5b 100644 --- a/Testing/Code/IO/otbDEMHandlerTest.cxx +++ b/Testing/Code/IO/otbDEMHandlerTest.cxx @@ -26,13 +26,13 @@ int otbDEMHandlerTest(int argc, char * argv[]) { const unsigned int Dimension = 2; - char * srtm_directory(argv[1]); - char * geoidFile(argv[2]); - const char * outputfilename(argv[3]); - double height = 0.0; - double height2 = 0.0; + char * srtm_directory(argv[1]); + char * geoidFile(argv[2]); + const char * outputfilename(argv[3]); + double height = 0.0; + double height2 = 0.0; - typedef otb::Image<float,Dimension> ImageType; + typedef otb::Image<float, Dimension> ImageType; typedef otb::DEMHandler DEMHandlerType; // Instantiating object @@ -40,11 +40,11 @@ int otbDEMHandlerTest(int argc, char * argv[]) demHandler->OpenGeoidFile(geoidFile); demHandler->OpenDEMDirectory(srtm_directory); - typedef otb::UtmInverseProjection utmProjection; - typedef utmProjection::InputPointType InputPoint; - InputPoint geoPoint; - geoPoint[0] = atof(argv[4]);//3.6999; - geoPoint[1] = atof(argv[5]);//44.08; + typedef otb::UtmInverseProjection utmProjection; + typedef utmProjection::InputPointType InputPoint; + InputPoint geoPoint; + geoPoint[0] = atof(argv[4]); //3.6999; + geoPoint[1] = atof(argv[5]); //44.08; height = demHandler->GetHeightAboveMSL(geoPoint); height2 = demHandler->GetHeightAboveEllipsoid(geoPoint); @@ -59,11 +59,7 @@ int otbDEMHandlerTest(int argc, char * argv[]) file << " -> Height above Ellipsoid: " << height2 << std::endl; std::cout << "Height above Ellipsoid: " << height2 << std::endl; - file.close(); - - - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx b/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx index eec564ebc3..2265254685 100644 --- a/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx +++ b/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx @@ -23,12 +23,11 @@ int otbDEMToImageGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::Image<unsigned char,Dimension> ImageType; - typedef otb::DEMToImageGenerator<ImageType> DEMToImageGeneratorType; + typedef otb::Image<unsigned char, Dimension> ImageType; + typedef otb::DEMToImageGenerator<ImageType> DEMToImageGeneratorType; // Instantiating object DEMToImageGeneratorType::Pointer object = DEMToImageGeneratorType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMToImageGeneratorTest.cxx b/Testing/Code/IO/otbDEMToImageGeneratorTest.cxx index c0f0171fdf..f2c39cb252 100644 --- a/Testing/Code/IO/otbDEMToImageGeneratorTest.cxx +++ b/Testing/Code/IO/otbDEMToImageGeneratorTest.cxx @@ -24,23 +24,25 @@ int otbDEMToImageGeneratorTest(int argc, char * argv[]) { - if (argc<9) - { - std::cout << argv[0] <<" folder path , output filename , Longitude Output Orign point , Latitude Output Origin point , X Output Size, Y Output size , X Spacing , Y Spacing" << std::endl; + if (argc < 9) + { + std::cout << argv[0] << + " folder path , output filename , Longitude Output Orign point , Latitude Output Origin point , X Output Size, Y Output size , X Spacing , Y Spacing" + << std::endl; return EXIT_FAILURE; - } + } char * folderPath = argv[1]; char * outputName = argv[2]; const unsigned int Dimension = 2; - typedef otb::Image<double, Dimension> ImageType; + typedef otb::Image<double, Dimension> ImageType; typedef otb::DEMToImageGenerator<ImageType> DEMToImageGeneratorType; typedef DEMToImageGeneratorType::DEMHandlerType DEMHandlerType; typedef DEMHandlerType::PointType PointType; typedef DEMToImageGeneratorType::SizeType SizeType; typedef DEMToImageGeneratorType::SpacingType SpacingType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; // Instantiating object DEMToImageGeneratorType::Pointer object = DEMToImageGeneratorType::New(); @@ -64,11 +66,10 @@ int otbDEMToImageGeneratorTest(int argc, char * argv[]) object->SetOutputSpacing(spacing); otb::StandardFilterWatcher watcher(object, "DEM to image generator"); - writer->SetFileName( outputName ); - writer->SetInput( object->GetOutput() ); + writer->SetFileName(outputName); + writer->SetInput(object->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMToOrthoImageGeneratorNew.cxx b/Testing/Code/IO/otbDEMToOrthoImageGeneratorNew.cxx index 214a18f20d..c02e8b8be1 100644 --- a/Testing/Code/IO/otbDEMToOrthoImageGeneratorNew.cxx +++ b/Testing/Code/IO/otbDEMToOrthoImageGeneratorNew.cxx @@ -24,12 +24,11 @@ int otbDEMToOrthoImageGeneratorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::Image<unsigned char,Dimension> ImageType; + typedef otb::Image<unsigned char, Dimension> ImageType; typedef otb::DEMToOrthoImageGenerator<ImageType, otb::UtmForwardProjection> DEMToImageGeneratorType; // Instantiating object DEMToImageGeneratorType::Pointer object = DEMToImageGeneratorType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMToOrthoImageGeneratorTest.cxx b/Testing/Code/IO/otbDEMToOrthoImageGeneratorTest.cxx index 90fdc098fd..506b575e79 100644 --- a/Testing/Code/IO/otbDEMToOrthoImageGeneratorTest.cxx +++ b/Testing/Code/IO/otbDEMToOrthoImageGeneratorTest.cxx @@ -25,24 +25,26 @@ int otbDEMToOrthoImageGeneratorTest(int argc, char * argv[]) { - if (argc<9) - { - std::cout << argv[0] <<" DEM folder path , output filename , Easting Output Orign point , Northing Output Origin point , X Output Size, Y Output size , X Spacing , Y Spacing, Zone, Hemisphere" << std::endl; + if (argc < 9) + { + std::cout << argv[0] << + " DEM folder path , output filename , Easting Output Orign point , Northing Output Origin point , X Output Size, Y Output size , X Spacing , Y Spacing, Zone, Hemisphere" + << std::endl; return EXIT_FAILURE; - } + } char * folderPath = argv[1]; char * outputName = argv[2]; const unsigned int Dimension = 2; - typedef otb::Image<double, Dimension> ImageType; - typedef otb::UtmInverseProjection MapProjectionType; + typedef otb::Image<double, Dimension> ImageType; + typedef otb::UtmInverseProjection MapProjectionType; typedef otb::DEMToOrthoImageGenerator<ImageType, MapProjectionType> DEMToImageGeneratorType; - typedef DEMToImageGeneratorType::DEMHandlerType DEMHandlerType; - typedef DEMHandlerType::PointType PointType; - typedef DEMToImageGeneratorType::SizeType SizeType; - typedef DEMToImageGeneratorType::SpacingType SpacingType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef DEMToImageGeneratorType::DEMHandlerType DEMHandlerType; + typedef DEMHandlerType::PointType PointType; + typedef DEMToImageGeneratorType::SizeType SizeType; + typedef DEMToImageGeneratorType::SpacingType SpacingType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; // Instantiating object MapProjectionType::Pointer mapProj = MapProjectionType::New(); @@ -60,7 +62,7 @@ int otbDEMToOrthoImageGeneratorTest(int argc, char * argv[]) SpacingType spacing; spacing[0] = ::atof(argv[7]); spacing[1] = ::atof(argv[8]); - std::cout<<atoi(argv[9])<<std::endl; + std::cout << atoi(argv[9]) << std::endl; mapProj->SetZone(::atoi(argv[9])); mapProj->SetHemisphere(argv[10][0]); @@ -72,8 +74,8 @@ int otbDEMToOrthoImageGeneratorTest(int argc, char * argv[]) object->SetMapProjection(mapProj); otb::StandardFilterWatcher watcher(object, "DEM to ortho image generator"); - writer->SetFileName( outputName ); - writer->SetInput( object->GetOutput() ); + writer->SetFileName(outputName); + writer->SetInput(object->GetOutput()); writer->Update(); diff --git a/Testing/Code/IO/otbDXFToSpatialObjectGroupFilterNew.cxx b/Testing/Code/IO/otbDXFToSpatialObjectGroupFilterNew.cxx index f42742218e..58ee8d4b79 100644 --- a/Testing/Code/IO/otbDXFToSpatialObjectGroupFilterNew.cxx +++ b/Testing/Code/IO/otbDXFToSpatialObjectGroupFilterNew.cxx @@ -23,12 +23,11 @@ int otbDXFToSpatialObjectGroupFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef itk::GroupSpatialObject<Dimension> GroupType; + typedef itk::GroupSpatialObject<Dimension> GroupType; typedef otb::DXFToSpatialObjectGroupFilter<GroupType> DXFToSpatialObjectGroupFilterType; // Instantiating object DXFToSpatialObjectGroupFilterType::Pointer object = DXFToSpatialObjectGroupFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDoubleImageIOTest.cxx b/Testing/Code/IO/otbDoubleImageIOTest.cxx index c97bb1d436..924bf862f4 100644 --- a/Testing/Code/IO/otbDoubleImageIOTest.cxx +++ b/Testing/Code/IO/otbDoubleImageIOTest.cxx @@ -33,26 +33,24 @@ int otbDoubleImageIOTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbFloatImageIOTest.cxx b/Testing/Code/IO/otbFloatImageIOTest.cxx index 87abd8dca6..85bd50d0ed 100644 --- a/Testing/Code/IO/otbFloatImageIOTest.cxx +++ b/Testing/Code/IO/otbFloatImageIOTest.cxx @@ -33,26 +33,24 @@ int otbFloatImageIOTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef float InputPixelType; - typedef float OutputPixelType; - const unsigned int Dimension = 2; + typedef float InputPixelType; + typedef float OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbGDALDriverDoubleWritingTest.cxx b/Testing/Code/IO/otbGDALDriverDoubleWritingTest.cxx index e318bf02a2..fae3b9c6cb 100644 --- a/Testing/Code/IO/otbGDALDriverDoubleWritingTest.cxx +++ b/Testing/Code/IO/otbGDALDriverDoubleWritingTest.cxx @@ -29,13 +29,13 @@ int otbGDALDriverDoubleWritingTest(int argc, char * argv[]) const char * outfname3 = argv[5]; const char * outfname4 = argv[6]; - typedef otb::VectorImage<double,2>ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::VectorImage<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; typedef otb::StreamingImageFileWriter<ImageType> StreamingWriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); StreamingWriterType::Pointer streamingWriter = StreamingWriterType::New(); reader->SetFileName(infname1); diff --git a/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx b/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx index 257513206c..96be0b1f3c 100644 --- a/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx @@ -27,13 +27,12 @@ int otbGDALImageIOTestCanRead(int argc, char* argv[]) { otb::GDALImageIO::Pointer lGDALImageIO = otb::GDALImageIO::New(); - bool lCanRead = lGDALImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::GDALImageIO : impossible d'ouvrir l'image "<<argv[1]<<"."<<std::endl; + bool lCanRead = lGDALImageIO->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::GDALImageIO : impossible d'ouvrir l'image " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx b/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx index 72f0c7cc6d..0d44856bf0 100644 --- a/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx @@ -27,12 +27,12 @@ int otbGDALImageIOTestCanWrite(int argc, char* argv[]) { otb::GDALImageIO::Pointer lGDALImageIO = otb::GDALImageIO::New(); - bool lCanWrite = lGDALImageIO->CanWriteFile(argv[1]); - if ( lCanWrite == false) - { - std::cerr << "Erreur otb::GDALImageIO : impossible d'ecrire l'image "<<argv[1]<<"."<<std::endl; + bool lCanWrite = lGDALImageIO->CanWriteFile(argv[1]); + if (lCanWrite == false) + { + std::cerr << "Erreur otb::GDALImageIO : impossible d'ecrire l'image " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbIOTests1.cxx b/Testing/Code/IO/otbIOTests1.cxx index c52471d394..b5ddb7314a 100644 --- a/Testing/Code/IO/otbIOTests1.cxx +++ b/Testing/Code/IO/otbIOTests1.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbImageFileReaderERS); diff --git a/Testing/Code/IO/otbIOTests10.cxx b/Testing/Code/IO/otbIOTests10.cxx index 46625f806a..b2ad8d1e16 100644 --- a/Testing/Code/IO/otbIOTests10.cxx +++ b/Testing/Code/IO/otbIOTests10.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbStreamingImageFileWriterTestCalculateNumberOfDivisions); diff --git a/Testing/Code/IO/otbIOTests11.cxx b/Testing/Code/IO/otbIOTests11.cxx index dd5aad2573..10a2c1b71a 100644 --- a/Testing/Code/IO/otbIOTests11.cxx +++ b/Testing/Code/IO/otbIOTests11.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbImageMetadataFileWriterTest); diff --git a/Testing/Code/IO/otbIOTests12.cxx b/Testing/Code/IO/otbIOTests12.cxx index cce0b7f8aa..f35b4d3f31 100644 --- a/Testing/Code/IO/otbIOTests12.cxx +++ b/Testing/Code/IO/otbIOTests12.cxx @@ -22,21 +22,19 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { -REGISTER_TEST(otbDEMHandlerNew); -REGISTER_TEST(otbDEMHandlerTest); -REGISTER_TEST(otbDEMToImageGeneratorNew); -REGISTER_TEST(otbDEMToImageGeneratorTest); -REGISTER_TEST(otbOssimElevManagerTest); -REGISTER_TEST(otbOssimElevManagerTest2); -REGISTER_TEST(otbOssimElevManagerTest4); -REGISTER_TEST(otbDEMToOrthoImageGeneratorNew); -REGISTER_TEST(otbDEMToOrthoImageGeneratorTest); -REGISTER_TEST(otbPrepareSRTMDirectoryNew); -REGISTER_TEST(otbPrepareSRTMDirectoryTest); + REGISTER_TEST(otbDEMHandlerNew); + REGISTER_TEST(otbDEMHandlerTest); + REGISTER_TEST(otbDEMToImageGeneratorNew); + REGISTER_TEST(otbDEMToImageGeneratorTest); + REGISTER_TEST(otbOssimElevManagerTest); + REGISTER_TEST(otbOssimElevManagerTest2); + REGISTER_TEST(otbOssimElevManagerTest4); + REGISTER_TEST(otbDEMToOrthoImageGeneratorNew); + REGISTER_TEST(otbDEMToOrthoImageGeneratorTest); + REGISTER_TEST(otbPrepareSRTMDirectoryNew); + REGISTER_TEST(otbPrepareSRTMDirectoryTest); } diff --git a/Testing/Code/IO/otbIOTests13.cxx b/Testing/Code/IO/otbIOTests13.cxx index d559e35016..a1e70187a8 100644 --- a/Testing/Code/IO/otbIOTests13.cxx +++ b/Testing/Code/IO/otbIOTests13.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbJPEG2000ImageIOTestCanRead); diff --git a/Testing/Code/IO/otbIOTests14.cxx b/Testing/Code/IO/otbIOTests14.cxx index 9dd8300be2..312cad8c39 100644 --- a/Testing/Code/IO/otbIOTests14.cxx +++ b/Testing/Code/IO/otbIOTests14.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbGDALDriverDoubleWritingTest); diff --git a/Testing/Code/IO/otbIOTests15.cxx b/Testing/Code/IO/otbIOTests15.cxx index fcf16ddc93..dd6113bf97 100644 --- a/Testing/Code/IO/otbIOTests15.cxx +++ b/Testing/Code/IO/otbIOTests15.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbVectorDataSourceNew); diff --git a/Testing/Code/IO/otbIOTests16.cxx b/Testing/Code/IO/otbIOTests16.cxx index 30d36b74d9..ca7379a717 100644 --- a/Testing/Code/IO/otbIOTests16.cxx +++ b/Testing/Code/IO/otbIOTests16.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbRADImageIOTestCanRead); diff --git a/Testing/Code/IO/otbIOTests17.cxx b/Testing/Code/IO/otbIOTests17.cxx index 3996c97896..7ec23262f9 100644 --- a/Testing/Code/IO/otbIOTests17.cxx +++ b/Testing/Code/IO/otbIOTests17.cxx @@ -22,13 +22,12 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" //Use only if OTB_USE_LIBLAS is on void RegisterTests() { -REGISTER_TEST(otbPointSetFileReaderNew); -REGISTER_TEST(otbPointSetFileReader); -REGISTER_TEST(otbPointSetFileReader2); + REGISTER_TEST(otbPointSetFileReaderNew); + REGISTER_TEST(otbPointSetFileReader); + REGISTER_TEST(otbPointSetFileReader2); } diff --git a/Testing/Code/IO/otbIOTests18.cxx b/Testing/Code/IO/otbIOTests18.cxx index 083aca40fe..ceb1f5a7ed 100644 --- a/Testing/Code/IO/otbIOTests18.cxx +++ b/Testing/Code/IO/otbIOTests18.cxx @@ -22,18 +22,17 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbTerraSarImageMetadataInterface); -REGISTER_TEST(otbImageKeywordlist); -REGISTER_TEST(otbSpotImageMetadataInterfaceNew); -REGISTER_TEST(otbIkonosImageMetadataInterfaceNew); -REGISTER_TEST(otbQuickBirdImageMetadataInterfaceNew); -REGISTER_TEST(otbTerraSarImageMetadataInterfaceNew); -REGISTER_TEST(otbImageMetadataInterfaceTest); -REGISTER_TEST(otbImageMetadataInterfaceTest2); -REGISTER_TEST(otbOssimJpegFileRessourceLeakTest); + REGISTER_TEST(otbTerraSarImageMetadataInterface); + REGISTER_TEST(otbImageKeywordlist); + REGISTER_TEST(otbSpotImageMetadataInterfaceNew); + REGISTER_TEST(otbIkonosImageMetadataInterfaceNew); + REGISTER_TEST(otbQuickBirdImageMetadataInterfaceNew); + REGISTER_TEST(otbTerraSarImageMetadataInterfaceNew); + REGISTER_TEST(otbImageMetadataInterfaceTest); + REGISTER_TEST(otbImageMetadataInterfaceTest2); + REGISTER_TEST(otbOssimJpegFileRessourceLeakTest); } diff --git a/Testing/Code/IO/otbIOTests19.cxx b/Testing/Code/IO/otbIOTests19.cxx index f9bae7f714..967b0c3bc5 100644 --- a/Testing/Code/IO/otbIOTests19.cxx +++ b/Testing/Code/IO/otbIOTests19.cxx @@ -22,16 +22,15 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbImageFileReaderServerName); -REGISTER_TEST(otbTileMapImageSourceNew); -REGISTER_TEST(otbTileMapImageSource); -REGISTER_TEST(otbTileMapFetcherNew); -REGISTER_TEST(otbTileMapFetcherTest); -REGISTER_TEST(otbTileMapImageIOTest); -REGISTER_TEST(otbTileMapWriter); + REGISTER_TEST(otbImageFileReaderServerName); + REGISTER_TEST(otbTileMapImageSourceNew); + REGISTER_TEST(otbTileMapImageSource); + REGISTER_TEST(otbTileMapFetcherNew); + REGISTER_TEST(otbTileMapFetcherTest); + REGISTER_TEST(otbTileMapImageIOTest); + REGISTER_TEST(otbTileMapWriter); } diff --git a/Testing/Code/IO/otbIOTests2.cxx b/Testing/Code/IO/otbIOTests2.cxx index 933573eed4..fc8bc362e2 100644 --- a/Testing/Code/IO/otbIOTests2.cxx +++ b/Testing/Code/IO/otbIOTests2.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbImageFileReaderTest); diff --git a/Testing/Code/IO/otbIOTests3.cxx b/Testing/Code/IO/otbIOTests3.cxx index c0c610316b..3849b53e84 100644 --- a/Testing/Code/IO/otbIOTests3.cxx +++ b/Testing/Code/IO/otbIOTests3.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbBSQImageIOTestCanRead); diff --git a/Testing/Code/IO/otbIOTests4.cxx b/Testing/Code/IO/otbIOTests4.cxx index 63da73a4b3..1584e8b9c6 100644 --- a/Testing/Code/IO/otbIOTests4.cxx +++ b/Testing/Code/IO/otbIOTests4.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { } diff --git a/Testing/Code/IO/otbIOTests5.cxx b/Testing/Code/IO/otbIOTests5.cxx index 259e67fb2e..9725a0def4 100644 --- a/Testing/Code/IO/otbIOTests5.cxx +++ b/Testing/Code/IO/otbIOTests5.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbGDALImageIOTestCanRead); diff --git a/Testing/Code/IO/otbIOTests6.cxx b/Testing/Code/IO/otbIOTests6.cxx index f32103e2c0..8a3ff1c07f 100644 --- a/Testing/Code/IO/otbIOTests6.cxx +++ b/Testing/Code/IO/otbIOTests6.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbGDALImageIOTestCanWrite); diff --git a/Testing/Code/IO/otbIOTests7.cxx b/Testing/Code/IO/otbIOTests7.cxx index 5888522437..19f4a34440 100644 --- a/Testing/Code/IO/otbIOTests7.cxx +++ b/Testing/Code/IO/otbIOTests7.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbImageFileReaderTest); diff --git a/Testing/Code/IO/otbIOTests8.cxx b/Testing/Code/IO/otbIOTests8.cxx index 25dcf7f39b..6cf0d6c982 100644 --- a/Testing/Code/IO/otbIOTests8.cxx +++ b/Testing/Code/IO/otbIOTests8.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbCoordinateToNameTest); diff --git a/Testing/Code/IO/otbIOTests9.cxx b/Testing/Code/IO/otbIOTests9.cxx index 649b4486dc..4ab258de50 100644 --- a/Testing/Code/IO/otbIOTests9.cxx +++ b/Testing/Code/IO/otbIOTests9.cxx @@ -22,10 +22,8 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" - void RegisterTests() { REGISTER_TEST(otbImageTest); diff --git a/Testing/Code/IO/otbIkonosImageMetadataInterfaceNew.cxx b/Testing/Code/IO/otbIkonosImageMetadataInterfaceNew.cxx index d0ca2e63c8..aed6131fcd 100644 --- a/Testing/Code/IO/otbIkonosImageMetadataInterfaceNew.cxx +++ b/Testing/Code/IO/otbIkonosImageMetadataInterfaceNew.cxx @@ -26,8 +26,7 @@ #include "otbIkonosImageMetadataInterface.h" - -int otbIkonosImageMetadataInterfaceNew (int argc, char* argv[]) +int otbIkonosImageMetadataInterfaceNew(int argc, char* argv[]) { otb::IkonosImageMetadataInterface::Pointer lImageMetadata = otb::IkonosImageMetadataInterface::New(); diff --git a/Testing/Code/IO/otbImageFileReaderERS.cxx b/Testing/Code/IO/otbImageFileReaderERS.cxx index b4679ed2b0..2619fc9e7b 100644 --- a/Testing/Code/IO/otbImageFileReaderERS.cxx +++ b/Testing/Code/IO/otbImageFileReaderERS.cxx @@ -31,48 +31,45 @@ int otbImageFileReaderERS(int argc, char* argv[]) { - if (argc<3) - { - std::cout << argv[0] <<"<inputImage> <outputImage>" << std::endl; + if (argc < 3) + { + std::cout << argv[0] << "<inputImage> <outputImage>" << std::endl; return EXIT_FAILURE; - } + } const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef float InputPixelType; - typedef short OutputPixelType; - const unsigned int Dimension = 2; + typedef float InputPixelType; + typedef short OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer complexReader = ReaderType::New(); - complexReader->SetFileName( inputFilename ); + complexReader->SetFileName(inputFilename); - typedef otb::MultiChannelExtractROI< InputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::MultiChannelExtractROI<InputPixelType, + OutputPixelType> ExtractROIFilterType; ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 10 ); - extractROIFilter->SetStartY( 10 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetInput( complexReader->GetOutput() ); + extractROIFilter->SetStartX(10); + extractROIFilter->SetStartY(10); + extractROIFilter->SetSizeX(100); + extractROIFilter->SetSizeY(100); + extractROIFilter->SetInput(complexReader->GetOutput()); WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( extractROIFilter->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetInput(extractROIFilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderMSTAR.cxx b/Testing/Code/IO/otbImageFileReaderMSTAR.cxx index 0da75d2755..c88382ac7d 100644 --- a/Testing/Code/IO/otbImageFileReaderMSTAR.cxx +++ b/Testing/Code/IO/otbImageFileReaderMSTAR.cxx @@ -26,28 +26,25 @@ #include "itkRescaleIntensityImageFilter.h" - int otbImageFileReaderMSTAR(int argc, char* argv[]) { - typedef float InputPixelType; + typedef float InputPixelType; typedef unsigned char OutputPixelType; - const unsigned int InputDimension = 2; + const unsigned int InputDimension = 2; - typedef otb::Image< itk::FixedArray<InputPixelType,2>, InputDimension > InputImageType; - typedef otb::Image< InputPixelType, InputDimension > InternalImageType; - typedef otb::Image< OutputPixelType, InputDimension > OutputImageType; + typedef otb::Image<itk::FixedArray<InputPixelType, 2>, InputDimension> InputImageType; + typedef otb::Image<InputPixelType, InputDimension> InternalImageType; + typedef otb::Image<OutputPixelType, InputDimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( argv[1] ); + reader->SetFileName(argv[1]); reader->Update(); - - typedef itk::ImageRegionConstIterator< InputImageType > ConstIteratorType; - typedef itk::ImageRegionIterator< InternalImageType> IteratorType; - + typedef itk::ImageRegionConstIterator<InputImageType> ConstIteratorType; + typedef itk::ImageRegionIterator<InternalImageType> IteratorType; InputImageType::RegionType inputRegion; @@ -60,9 +57,8 @@ int otbImageFileReaderMSTAR(int argc, char* argv[]) size[0] = reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]; size[1] = reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]; - inputRegion.SetSize( size ); - inputRegion.SetIndex( inputStart ); - + inputRegion.SetSize(size); + inputRegion.SetIndex(inputStart); InternalImageType::RegionType outputRegion; @@ -71,51 +67,48 @@ int otbImageFileReaderMSTAR(int argc, char* argv[]) outputStart[0] = 0; outputStart[1] = 0; - outputRegion.SetSize( size ); - outputRegion.SetIndex( outputStart ); + outputRegion.SetSize(size); + outputRegion.SetIndex(outputStart); InternalImageType::Pointer magnitude = InternalImageType::New(); - magnitude->SetRegions( inputRegion ); + magnitude->SetRegions(inputRegion); const InternalImageType::SpacingType& spacing = reader->GetOutput()->GetSpacing(); - const InternalImageType::PointType& inputOrigin = reader->GetOutput()->GetOrigin(); - double outputOrigin[ InputDimension ]; + const InternalImageType::PointType& inputOrigin = reader->GetOutput()->GetOrigin(); + double outputOrigin[InputDimension]; - for (unsigned int i=0; i< InputDimension; i++) - { + for (unsigned int i = 0; i < InputDimension; i++) + { outputOrigin[i] = inputOrigin[i] + spacing[i] * inputStart[i]; - } + } - magnitude->SetSpacing( spacing ); - magnitude->SetOrigin( outputOrigin ); + magnitude->SetSpacing(spacing); + magnitude->SetOrigin(outputOrigin); magnitude->Allocate(); + ConstIteratorType inputIt(reader->GetOutput(), inputRegion); + IteratorType outputIt(magnitude, outputRegion); - ConstIteratorType inputIt( reader->GetOutput(), inputRegion ); - IteratorType outputIt( magnitude, outputRegion ); - - for ( inputIt.GoToBegin(), outputIt.GoToBegin(); !inputIt.IsAtEnd(); - ++inputIt, ++outputIt) - { - outputIt.Set( inputIt.Get()[0] ); + for (inputIt.GoToBegin(), outputIt.GoToBegin(); !inputIt.IsAtEnd(); + ++inputIt, ++outputIt) + { + outputIt.Set(inputIt.Get()[0]); // std::cout << inputIt.Get()[0] << " - " << inputIt.Get()[1] << std::endl; - } - + } - typedef itk::RescaleIntensityImageFilter< InternalImageType, - OutputImageType > RescalerType; + typedef itk::RescaleIntensityImageFilter<InternalImageType, + OutputImageType> RescalerType; RescalerType::Pointer rescaler = RescalerType::New(); - rescaler->SetOutputMinimum( itk::NumericTraits< OutputPixelType >::min()); - rescaler->SetOutputMaximum( itk::NumericTraits< OutputPixelType >::max()); - rescaler->SetInput( magnitude ); - + rescaler->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min()); + rescaler->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max()); + rescaler->SetInput(magnitude); - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; WriterType::Pointer writer = WriterType::New(); - writer->SetInput( rescaler->GetOutput() ); - writer->SetFileName( argv[2] ); + writer->SetInput(rescaler->GetOutput()); + writer->SetFileName(argv[2]); writer->Update(); diff --git a/Testing/Code/IO/otbImageFileReaderONERA.cxx b/Testing/Code/IO/otbImageFileReaderONERA.cxx index 2250edb896..53be5a7904 100644 --- a/Testing/Code/IO/otbImageFileReaderONERA.cxx +++ b/Testing/Code/IO/otbImageFileReaderONERA.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbVectorImage.h" #include "itkExceptionObject.h" #include <iostream> @@ -34,37 +33,35 @@ int otbImageFileReaderONERATest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef float InputPixelType; - typedef float OutputPixelType; - const unsigned int Dimension = 2; + typedef float InputPixelType; + typedef float OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer Reader = ReaderType::New(); - typedef otb::MultiChannelExtractROI< OutputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::MultiChannelExtractROI<OutputPixelType, + OutputPixelType> ExtractROIFilterType; ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 10 ); - extractROIFilter->SetStartY( 10 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetInput( Reader->GetOutput() ); + extractROIFilter->SetStartX(10); + extractROIFilter->SetStartY(10); + extractROIFilter->SetSizeX(100); + extractROIFilter->SetSizeY(100); + extractROIFilter->SetInput(Reader->GetOutput()); WriterType::Pointer writer = WriterType::New(); - Reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - writer->SetInput( extractROIFilter->GetOutput() ); + Reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); + writer->SetInput(extractROIFilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx b/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx index 43b64c1745..7a917e2e37 100644 --- a/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx +++ b/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx @@ -36,52 +36,49 @@ int otbImageFileReaderONERAComplex(int argc, char* argv[]) const char * outputRealFilename = argv[2]; const char * outputImagFilename = argv[3]; - typedef std::complex<float> InputPixelType; - typedef float OutputPixelType; - const unsigned int Dimension = 2; + typedef std::complex<float> InputPixelType; + typedef float OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer Reader = ReaderType::New(); - Reader->SetFileName( inputFilename ); + Reader->SetFileName(inputFilename); - typedef otb::ExtractROI< InputPixelType, - InputPixelType > ExtractROIFilterType; + typedef otb::ExtractROI<InputPixelType, + InputPixelType> ExtractROIFilterType; ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 10 ); - extractROIFilter->SetStartY( 10 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetInput( Reader->GetOutput() ); + extractROIFilter->SetStartX(10); + extractROIFilter->SetStartY(10); + extractROIFilter->SetSizeX(100); + extractROIFilter->SetSizeY(100); + extractROIFilter->SetInput(Reader->GetOutput()); typedef itk::ComplexToRealImageFilter< - InputImageType, OutputImageType > RealFilterType; + InputImageType, OutputImageType> RealFilterType; typedef itk::ComplexToImaginaryImageFilter< - InputImageType, OutputImageType > ImagFilterType; + InputImageType, OutputImageType> ImagFilterType; RealFilterType::Pointer realFilter = RealFilterType::New(); - realFilter->SetInput( extractROIFilter->GetOutput() ); + realFilter->SetInput(extractROIFilter->GetOutput()); ImagFilterType::Pointer imagFilter = ImagFilterType::New(); - imagFilter->SetInput( extractROIFilter->GetOutput() ); - + imagFilter->SetInput(extractROIFilter->GetOutput()); WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputRealFilename ); - writer->SetInput( realFilter->GetOutput() ); + writer->SetFileName(outputRealFilename); + writer->SetInput(realFilter->GetOutput()); writer->Update(); writer = WriterType::New(); - writer->SetFileName( outputImagFilename ); - writer->SetInput( imagFilter->GetOutput() ); + writer->SetFileName(outputImagFilename); + writer->SetInput(imagFilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderRADChar.cxx b/Testing/Code/IO/otbImageFileReaderRADChar.cxx index ca4cfab96a..521c5b2195 100644 --- a/Testing/Code/IO/otbImageFileReaderRADChar.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADChar.cxx @@ -33,17 +33,16 @@ int otbImageFileReaderRADChar(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef char InputPixelType; - typedef char OutputPixelType; + typedef char InputPixelType; + typedef char OutputPixelType; + const unsigned int Dimension = 2; - const unsigned int Dimension = 2; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; /* typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; @@ -51,12 +50,11 @@ int otbImageFileReaderRADChar(int argc, char* argv[]) ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderRADComplexDouble.cxx b/Testing/Code/IO/otbImageFileReaderRADComplexDouble.cxx index 19e442281b..b5497dba93 100644 --- a/Testing/Code/IO/otbImageFileReaderRADComplexDouble.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADComplexDouble.cxx @@ -33,25 +33,24 @@ int otbImageFileReaderRADComplexDouble(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef std::complex<double> InputPixelType; - typedef std::complex<double> OutputPixelType; - const unsigned int Dimension = 2; + typedef std::complex<double> InputPixelType; + typedef std::complex<double> OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderRADComplexFloat.cxx b/Testing/Code/IO/otbImageFileReaderRADComplexFloat.cxx index 9e8a8c40f2..6cb0f47da0 100644 --- a/Testing/Code/IO/otbImageFileReaderRADComplexFloat.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADComplexFloat.cxx @@ -33,25 +33,24 @@ int otbImageFileReaderRADComplexFloat(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef std::complex<float> InputPixelType; - typedef std::complex<float> OutputPixelType; - const unsigned int Dimension = 2; + typedef std::complex<float> InputPixelType; + typedef std::complex<float> OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx b/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx index ffd13cefe3..6aeeee63c5 100644 --- a/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx @@ -33,38 +33,36 @@ int otbImageFileReaderRADComplexFloatExtract(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef std::complex<float> InputPixelType; - typedef std::complex<float> OutputPixelType; - const unsigned int Dimension = 2; + typedef std::complex<float> InputPixelType; + typedef std::complex<float> OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - - typedef otb::ExtractROI< InputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::ExtractROI<InputPixelType, + OutputPixelType> ExtractROIFilterType; ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); extractROIFilter->SetInput(reader->GetOutput()); - extractROIFilter->SetStartX( 10 ); - extractROIFilter->SetStartY( 10 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); + extractROIFilter->SetStartX(10); + extractROIFilter->SetStartY(10); + extractROIFilter->SetSizeX(100); + extractROIFilter->SetSizeY(100); - writer->SetInput( extractROIFilter->GetOutput() ); + writer->SetInput(extractROIFilter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderRADComplexInt.cxx b/Testing/Code/IO/otbImageFileReaderRADComplexInt.cxx index 04a859dda6..dd31fb10f5 100644 --- a/Testing/Code/IO/otbImageFileReaderRADComplexInt.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADComplexInt.cxx @@ -33,25 +33,24 @@ int otbImageFileReaderRADComplexInt(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef std::complex<int> InputPixelType; - typedef std::complex<int> OutputPixelType; - const unsigned int Dimension = 2; + typedef std::complex<int> InputPixelType; + typedef std::complex<int> OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderRADFloat.cxx b/Testing/Code/IO/otbImageFileReaderRADFloat.cxx index 39487d91a6..bc65b2767b 100644 --- a/Testing/Code/IO/otbImageFileReaderRADFloat.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADFloat.cxx @@ -33,25 +33,24 @@ int otbImageFileReaderRADFloat(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef float InputPixelType; - typedef float OutputPixelType; - const unsigned int Dimension = 2; + typedef float InputPixelType; + typedef float OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileReaderRADInt.cxx b/Testing/Code/IO/otbImageFileReaderRADInt.cxx index 838ff70788..79da7848f0 100644 --- a/Testing/Code/IO/otbImageFileReaderRADInt.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADInt.cxx @@ -33,25 +33,24 @@ int otbImageFileReaderRADInt(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef int InputPixelType; - typedef int OutputPixelType; - const unsigned int Dimension = 2; + typedef int InputPixelType; + typedef int OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderRGBTest.cxx b/Testing/Code/IO/otbImageFileReaderRGBTest.cxx index 43639724d7..98ceebd1b4 100644 --- a/Testing/Code/IO/otbImageFileReaderRGBTest.cxx +++ b/Testing/Code/IO/otbImageFileReaderRGBTest.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbImageFileWriter.h" #include "otbImageFileReader.h" #include "otbImage.h" @@ -28,33 +27,30 @@ #include "itkExceptionObject.h" #include <iostream> - int otbImageFileReaderRGBTest(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef itk::RGBPixel<unsigned char> InputPixelType; - typedef itk::RGBPixel<unsigned char> OutputPixelType; - const unsigned int Dimension = 2; + typedef itk::RGBPixel<unsigned char> InputPixelType; + typedef itk::RGBPixel<unsigned char> OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderServerName.cxx b/Testing/Code/IO/otbImageFileReaderServerName.cxx index 28d6453bf0..648a11ec4f 100644 --- a/Testing/Code/IO/otbImageFileReaderServerName.cxx +++ b/Testing/Code/IO/otbImageFileReaderServerName.cxx @@ -32,24 +32,23 @@ int otbImageFileReaderServerName(int argc, char* argv[]) // Verify the number of parameters in the command line const char * inputFilename = argv[1]; - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - ReaderType::Pointer reader = ReaderType::New(); - - reader->SetFileName( inputFilename ); - + + reader->SetFileName(inputFilename); + reader->GenerateOutputInformation(); - - if(reader->GetOutput()->GetImageKeywordlist().GetSize() == 0) - { - std::cerr<<"Error: Keyword list is empty "<<std::endl; + + if (reader->GetOutput()->GetImageKeywordlist().GetSize() == 0) + { + std::cerr << "Error: Keyword list is empty " << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderTest.cxx b/Testing/Code/IO/otbImageFileReaderTest.cxx index 622590315e..d1ad345b39 100644 --- a/Testing/Code/IO/otbImageFileReaderTest.cxx +++ b/Testing/Code/IO/otbImageFileReaderTest.cxx @@ -33,26 +33,24 @@ int otbImageFileReaderTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileReaderTestFloat.cxx b/Testing/Code/IO/otbImageFileReaderTestFloat.cxx index da02c39b7c..da8551188a 100644 --- a/Testing/Code/IO/otbImageFileReaderTestFloat.cxx +++ b/Testing/Code/IO/otbImageFileReaderTestFloat.cxx @@ -33,26 +33,24 @@ int otbImageFileReaderTestFloat(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef float InputPixelType; - typedef float OutputPixelType; - const unsigned int Dimension = 2; + typedef float InputPixelType; + typedef float OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx b/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx index 1a502ea1a6..da7dc391f7 100644 --- a/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx +++ b/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx @@ -33,36 +33,34 @@ int otbImageFileWriterONERAComplex(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef std::complex<float> PixelType; - const unsigned int Dimension = 2; + typedef std::complex<float> PixelType; + const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::ImageFileWriter< ImageType > WriterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; ReaderType::Pointer complexReader = ReaderType::New(); - complexReader->SetFileName( inputFilename ); + complexReader->SetFileName(inputFilename); - typedef otb::ExtractROI< PixelType, - PixelType > ExtractROIFilterType; + typedef otb::ExtractROI<PixelType, + PixelType> ExtractROIFilterType; ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 20 ); - extractROIFilter->SetStartY( 20 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetInput( complexReader->GetOutput() ); + extractROIFilter->SetStartX(20); + extractROIFilter->SetStartY(20); + extractROIFilter->SetSizeX(100); + extractROIFilter->SetSizeY(100); + extractROIFilter->SetInput(complexReader->GetOutput()); extractROIFilter->Update(); WriterType::Pointer complexWriter = WriterType::New(); - complexWriter->SetFileName( outputFilename ); - complexWriter->SetInput( extractROIFilter->GetOutput() ); + complexWriter->SetFileName(outputFilename); + complexWriter->SetInput(extractROIFilter->GetOutput()); complexWriter->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileWriterRGBTest.cxx b/Testing/Code/IO/otbImageFileWriterRGBTest.cxx index 76fbba928e..8d1dec8a55 100644 --- a/Testing/Code/IO/otbImageFileWriterRGBTest.cxx +++ b/Testing/Code/IO/otbImageFileWriterRGBTest.cxx @@ -34,26 +34,24 @@ int otbImageFileWriterRGBTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef itk::RGBPixel<unsigned char> InputPixelType; - typedef itk::RGBPixel<unsigned char> OutputPixelType; - const unsigned int Dimension = 2; + typedef itk::RGBPixel<unsigned char> InputPixelType; + typedef itk::RGBPixel<unsigned char> OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx b/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx index bfe77adcbf..6616a03be4 100644 --- a/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx +++ b/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx @@ -34,18 +34,18 @@ int otbImageFileWriterStreamingONERAComplex(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef std::complex<float> PixelType; - const unsigned int Dimension = 2; + typedef std::complex<float> PixelType; + const unsigned int Dimension = 2; - typedef otb::Image<PixelType, Dimension > ImageType; + typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::StreamingImageFileWriter< ImageType > WriterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; /* typedef itk::StreamingImageFilter< ImageType, ImageType > StreamingType;*/ ReaderType::Pointer complexReader = ReaderType::New(); - complexReader->SetFileName( inputFilename ); + complexReader->SetFileName(inputFilename); /* StreamingType::Pointer streaming = StreamingType::New(); streaming->SetNumberOfStreamDivisions(100); @@ -53,11 +53,9 @@ int otbImageFileWriterStreamingONERAComplex(int argc, char* argv[]) */ WriterType::Pointer complexWriter = WriterType::New(); complexWriter->SetNumberOfStreamDivisions(100); - complexWriter->SetFileName( outputFilename ); - complexWriter->SetInput( complexReader->GetOutput() ); + complexWriter->SetFileName(outputFilename); + complexWriter->SetInput(complexReader->GetOutput()); complexWriter->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbImageFileWriterTest.cxx b/Testing/Code/IO/otbImageFileWriterTest.cxx index 6ba77951b2..376fa93082 100644 --- a/Testing/Code/IO/otbImageFileWriterTest.cxx +++ b/Testing/Code/IO/otbImageFileWriterTest.cxx @@ -33,25 +33,24 @@ int otbImageFileWriterTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageIOFactoryNew.cxx b/Testing/Code/IO/otbImageIOFactoryNew.cxx index e028f56532..03de1ef4f8 100644 --- a/Testing/Code/IO/otbImageIOFactoryNew.cxx +++ b/Testing/Code/IO/otbImageIOFactoryNew.cxx @@ -24,7 +24,7 @@ #include "itkExceptionObject.h" #include <iostream> -int otbImageIOFactoryNew(int argc, char* argv []) +int otbImageIOFactoryNew(int argc, char* argv[]) { otb::ImageIOFactory * lImageIOFactory; lImageIOFactory = NULL; diff --git a/Testing/Code/IO/otbImageKeywordlist.cxx b/Testing/Code/IO/otbImageKeywordlist.cxx index 22a02f046f..93e2eb945e 100644 --- a/Testing/Code/IO/otbImageKeywordlist.cxx +++ b/Testing/Code/IO/otbImageKeywordlist.cxx @@ -29,16 +29,16 @@ #include "projection/ossimProjection.h" #include "projection/ossimProjectionFactoryRegistry.h" #include "ossim/ossimPluginProjectionFactory.h" -#include "base/ossimFilename.h" +#include "base/ossimFilename.h" int otbImageKeywordlist(int argc, char* argv[]) { if (argc != 4) - { + { std::cout << argv[0] << " <input filename> <output filename> <output filename2>" << std::endl; return EXIT_FAILURE; - } + } char * filename = argv[1]; char * outFilename = argv[2]; @@ -51,25 +51,25 @@ int otbImageKeywordlist(int argc, char* argv[]) file2.open(outFilename2); file2 << std::setprecision(15); - bool hasMetaData = false; + bool hasMetaData = false; ossimKeywordlist geom_kwl, geom_kwl2, geom_kwl3; /** Don't use FactoryRegistry because of its default factory that can conflict * with plugins factor (cf. TSX .tif image read as QB)*/ // test ossim plugin factory ossimProjection * projection = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection( - ossimFilename(filename), 0); + ossimFilename(filename), 0); // if ossim plugins factory failed, then test ossim factory if (!projection) - { + { projection = ossimProjectionFactoryRegistry::instance()->createProjection(ossimFilename(filename), 0); if (!projection) - { - itkGenericExceptionMacro( <<"OSSIM Instanciate projection FAILED ! "); + { + itkGenericExceptionMacro(<< "OSSIM Instanciate projection FAILED ! "); return EXIT_FAILURE; + } } - } hasMetaData = projection->saveState(geom_kwl); otb::ImageKeywordlist otb_kwl; @@ -89,7 +89,7 @@ int otbImageKeywordlist(int argc, char* argv[]) /** Search keyword in meter_per_pixel to truncate precision */ ossimString s; - double valueX, valueY; + double valueX, valueY; otb_kwl.convertToOSSIMKeywordlist(geom_kwl2); @@ -98,30 +98,30 @@ int otbImageKeywordlist(int argc, char* argv[]) s = geom_kwl2.find("meters_per_pixel_x"); if (s != "") - { + { valueX = s.toDouble(); file << "truncate_meter_per_pixel_x " << valueX << std::endl; - } + } s = geom_kwl2.find("meters_per_pixel_y"); if (s != "") - { + { valueY = s.toDouble(); file << "truncate_meter_per_pixel_y " << valueY << std::endl; - } + } otb_kwl2.convertToOSSIMKeywordlist(geom_kwl3); s = geom_kwl3.find("meters_per_pixel_x"); if (s != "") - { + { valueX = s.toDouble(); file2 << "truncate_meter_per_pixel_x " << valueX << std::endl; - } + } s = geom_kwl3.find("meters_per_pixel_y"); if (s != "") - { + { valueY = s.toDouble(); file2 << "truncate_meter_per_pixel_y " << valueY << std::endl; - } + } file.close(); file2.close(); diff --git a/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx b/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx index f02345c9f9..5b0aa33127 100644 --- a/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx +++ b/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx @@ -33,25 +33,24 @@ int otbImageMetadataFileWriterTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageMetadataInterfaceTest.cxx b/Testing/Code/IO/otbImageMetadataInterfaceTest.cxx index efb8f58b58..064ebac35d 100644 --- a/Testing/Code/IO/otbImageMetadataInterfaceTest.cxx +++ b/Testing/Code/IO/otbImageMetadataInterfaceTest.cxx @@ -29,40 +29,53 @@ #include "otbImageMetadataInterfaceBase.h" #include "otbImageMetadataInterfaceFactory.h" -int otbImageMetadataInterfaceTest (int argc, char* argv[]) +int otbImageMetadataInterfaceTest(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - - typedef otb::VectorImage< double, 2 > InputImageType; - typedef otb::ImageFileReader< InputImageType > ImageReaderType; - + + typedef otb::VectorImage<double, 2> InputImageType; + typedef otb::ImageFileReader<InputImageType> ImageReaderType; + ImageReaderType::Pointer reader = ImageReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->UpdateOutputInformation(); - - otb::ImageMetadataInterfaceBase::Pointer lImageMetadata = otb::ImageMetadataInterfaceFactory::CreateIMI(reader->GetOutput()->GetMetaDataDictionary()); - + + otb::ImageMetadataInterfaceBase::Pointer lImageMetadata = otb::ImageMetadataInterfaceFactory::CreateIMI( + reader->GetOutput()->GetMetaDataDictionary()); + std::ofstream file; file.open(outputFilename); - std::cout<<lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetSensorID: "<<lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetPhysicalGain: "<<lImageMetadata->GetPhysicalGain(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetPhysicalBias: "<<lImageMetadata->GetPhysicalBias(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetMinute: "<<lImageMetadata->GetMinute(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetHour: "<<lImageMetadata->GetHour(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetDay: "<<lImageMetadata->GetDay(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetMonth: "<<lImageMetadata->GetMonth(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetYear: "<<lImageMetadata->GetYear(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetProductionDay: "<<lImageMetadata->GetProductionDay(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetProductionMonth: "<<lImageMetadata->GetProductionMonth(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetProductionYear: "<<lImageMetadata->GetProductionYear(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetSolarIrradiance: "<<lImageMetadata->GetSolarIrradiance(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetSatElevation: "<<lImageMetadata->GetSatElevation(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetSatAzimuth: "<<lImageMetadata->GetSatAzimuth(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetSunElevation: "<<lImageMetadata->GetSunElevation(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetSunAzimuth: "<<lImageMetadata->GetSunAzimuth(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; + std::cout << lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetSensorID: " << lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetPhysicalGain: " << lImageMetadata->GetPhysicalGain(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetPhysicalBias: " << lImageMetadata->GetPhysicalBias(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetMinute: " << lImageMetadata->GetMinute(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetHour: " << lImageMetadata->GetHour(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetDay: " << lImageMetadata->GetDay(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetMonth: " << lImageMetadata->GetMonth(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetYear: " << lImageMetadata->GetYear(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetProductionDay: " << lImageMetadata->GetProductionDay(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetProductionMonth: " << lImageMetadata->GetProductionMonth(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetProductionYear: " << lImageMetadata->GetProductionYear(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetSolarIrradiance: " << lImageMetadata->GetSolarIrradiance(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetSatElevation: " << lImageMetadata->GetSatElevation(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetSatAzimuth: " << lImageMetadata->GetSatAzimuth(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetSunElevation: " << lImageMetadata->GetSunElevation(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetSunAzimuth: " << lImageMetadata->GetSunAzimuth(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; file.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/IO/otbImageMetadataInterfaceTest2.cxx b/Testing/Code/IO/otbImageMetadataInterfaceTest2.cxx index d901e83820..5bffbc4a2a 100644 --- a/Testing/Code/IO/otbImageMetadataInterfaceTest2.cxx +++ b/Testing/Code/IO/otbImageMetadataInterfaceTest2.cxx @@ -29,28 +29,28 @@ #include "otbImageMetadataInterfaceBase.h" #include "otbImageMetadataInterfaceFactory.h" - -int otbImageMetadataInterfaceTest2 (int argc, char* argv[]) +int otbImageMetadataInterfaceTest2(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef otb::Image< double, 2 > InputImageType; - typedef otb::ImageFileReader< InputImageType > ImageReaderType; + typedef otb::Image<double, 2> InputImageType; + typedef otb::ImageFileReader<InputImageType> ImageReaderType; ImageReaderType::Pointer reader = ImageReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->UpdateOutputInformation(); - otb::ImageMetadataInterfaceBase::Pointer lImageMetadata = otb::ImageMetadataInterfaceFactory::CreateIMI(reader->GetOutput()->GetMetaDataDictionary()); - + otb::ImageMetadataInterfaceBase::Pointer lImageMetadata = otb::ImageMetadataInterfaceFactory::CreateIMI( + reader->GetOutput()->GetMetaDataDictionary()); + std::ofstream file; file.open(outputFilename); //Test the image interface lImageMetadata->SetImage(reader->GetOutput()); - file<< lImageMetadata->GetProjectionRef() << std::endl; + file << lImageMetadata->GetProjectionRef() << std::endl; file.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx b/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx index 795cc57fb1..9eeef05ddf 100644 --- a/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx +++ b/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx @@ -33,25 +33,24 @@ int otbImageMetadataStreamingFileWriterTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageSeriesFileReader.cxx b/Testing/Code/IO/otbImageSeriesFileReader.cxx index a37547908c..dc2a6fdb98 100644 --- a/Testing/Code/IO/otbImageSeriesFileReader.cxx +++ b/Testing/Code/IO/otbImageSeriesFileReader.cxx @@ -28,19 +28,19 @@ #include "otbCommandProgressUpdate.h" #include "otbCommandLineArgumentParser.h" -int otbImageSeriesFileReader(int argc, char* argv[] ) +int otbImageSeriesFileReader(int argc, char* argv[]) { const char * enviMetaFile = argv[1]; const char * outputFile = argv[2]; - const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::VectorImage< PixelType, Dimension > ImageType; - typedef otb::ImageList< ImageType > ImageListType; + const unsigned int Dimension = 2; + typedef unsigned char PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::ImageList<ImageType> ImageListType; - typedef otb::ImageSeriesFileReader< ImageType > ImageReader; + typedef otb::ImageSeriesFileReader<ImageType> ImageReader; ImageReader::Pointer reader = ImageReader::New(); - reader->SetFileName( enviMetaFile ); + reader->SetFileName(enviMetaFile); reader->Update(); ossimFilename outputFilenameBase(outputFile); @@ -49,31 +49,29 @@ int otbImageSeriesFileReader(int argc, char* argv[] ) typedef otb::StreamingImageFileWriter<ImageType> WriterType; - for ( unsigned int i = 0; i < imageList->Size(); i++ ) - { + for (unsigned int i = 0; i < imageList->Size(); i++) + { itk::OStringStream title; title << "Image no " << i; std::cerr << title.str().c_str() << "\n"; std::stringstream number; number << "-" << i; - ossimString fileNum(number.str()); + ossimString fileNum(number.str()); ossimFilename outputFilename; - outputFilename.merge( "", outputFilenameBase.path(), - outputFilenameBase.fileNoExtension()+fileNum, - outputFilenameBase.ext() - ); + outputFilename.merge("", outputFilenameBase.path(), + outputFilenameBase.fileNoExtension() + fileNum, + outputFilenameBase.ext() + ); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFilename); writer->SetInput(reader->GetOutput(i)); writer->Update(); - } + } std::cerr << "Normal Exit\n"; return EXIT_SUCCESS; } - - diff --git a/Testing/Code/IO/otbImageTest.cxx b/Testing/Code/IO/otbImageTest.cxx index b93bacbdf5..198ecd85c6 100644 --- a/Testing/Code/IO/otbImageTest.cxx +++ b/Testing/Code/IO/otbImageTest.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include <iostream> #include <fstream> @@ -29,7 +28,6 @@ #include "otbImage.h" #include "otbImageFileReader.h" - int otbImageTest(int argc, char* argv[]) { // Verify the number of parameters in the command line @@ -37,23 +35,22 @@ int otbImageTest(int argc, char* argv[]) const char * outputAsciiFilename = argv[2]; // unsigned int GCPnum((unsigned int)::atoi(argv[2])); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; std::ofstream file; file.open(outputAsciiFilename); - typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; InputImageType::Pointer image = InputImageType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; - + typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->GenerateOutputInformation(); image = reader->GetOutput(); @@ -75,8 +72,8 @@ int otbImageTest(int argc, char* argv[]) unsigned int GCPCount = image->GetGCPCount(); file << "GCP Count " << image->GetGCPCount() << std::endl; - for (unsigned int GCPnum = 0; GCPnum < GCPCount; GCPnum++ ) - { + for (unsigned int GCPnum = 0; GCPnum < GCPCount; GCPnum++) + { file << "GCP[" << GCPnum << "] Id " << image->GetGCPId(GCPnum) << std::endl; file << "GCP[" << GCPnum << "] Info " << image->GetGCPInfo(GCPnum) << std::endl; file << "GCP[" << GCPnum << "] Row " << image->GetGCPRow(GCPnum) << std::endl; @@ -85,49 +82,47 @@ int otbImageTest(int argc, char* argv[]) file << "GCP[" << GCPnum << "] Y " << image->GetGCPY(GCPnum) << std::endl; file << "GCP[" << GCPnum << "] Z " << image->GetGCPZ(GCPnum) << std::endl; file << "----------------" << std::endl; - } + } InputImageType::VectorType tab = image->GetGeoTransform(); file << "Geo Transform " << std::endl; - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " " <<i<<" -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " " << i << " -> " << tab[i] << std::endl; + } tab.clear(); tab = image->GetUpperLeftCorner(); file << "Corners " << std::endl; - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " UL[" <<i<<"] -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " UL[" << i << "] -> " << tab[i] << std::endl; + } tab.clear(); tab = image->GetUpperRightCorner(); - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " UR[" <<i<<"] -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " UR[" << i << "] -> " << tab[i] << std::endl; + } tab.clear(); tab = image->GetLowerLeftCorner(); - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " LL[" <<i<<"] -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " LL[" << i << "] -> " << tab[i] << std::endl; + } tab.clear(); tab = image->GetLowerRightCorner(); - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " LR[" <<i<<"] -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " LR[" << i << "] -> " << tab[i] << std::endl; + } tab.clear(); file.close(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbIntImageIOTest.cxx b/Testing/Code/IO/otbIntImageIOTest.cxx index c97f61f471..768e689598 100644 --- a/Testing/Code/IO/otbIntImageIOTest.cxx +++ b/Testing/Code/IO/otbIntImageIOTest.cxx @@ -33,26 +33,24 @@ int otbIntImageIOTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef int InputPixelType; - typedef int OutputPixelType; - const unsigned int Dimension = 2; + typedef int InputPixelType; + typedef int OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx b/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx index 86ea08d330..b618999ae7 100644 --- a/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx @@ -27,11 +27,12 @@ int otbJPEG2000ImageIOTestCanRead(int argc, char* argv[]) { otb::JPEG2000ImageIO::Pointer lJPEG2000ImageIO = otb::JPEG2000ImageIO::New(); - bool lCanRead = lJPEG2000ImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::JPEG2000ImageIO : impossible to open the image file JPEG2000 "<<argv[1]<<"."<<std::endl; + bool lCanRead = lJPEG2000ImageIO->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::JPEG2000ImageIO : impossible to open the image file JPEG2000 " << argv[1] << "." << + std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx b/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx index 9278f763d8..3d38a05518 100644 --- a/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx @@ -27,12 +27,13 @@ int otbJPEG2000ImageIOTestCanWrite(int argc, char* argv[]) { otb::JPEG2000ImageIO::Pointer lJPEG2000ImageIO = otb::JPEG2000ImageIO::New(); - bool lCanWrite = lJPEG2000ImageIO->CanWriteFile(argv[1]); - if ( lCanWrite == false) - { - std::cerr << "Erreur otb::JPEG2000ImageIO : impossible to create the image file JPEG2000 "<<argv[1]<<"."<<std::endl; + bool lCanWrite = lJPEG2000ImageIO->CanWriteFile(argv[1]); + if (lCanWrite == false) + { + std::cerr << "Erreur otb::JPEG2000ImageIO : impossible to create the image file JPEG2000 " << argv[1] << "." << + std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbKMLVectorDataIONew.cxx b/Testing/Code/IO/otbKMLVectorDataIONew.cxx index ab388a1298..d30521cffa 100644 --- a/Testing/Code/IO/otbKMLVectorDataIONew.cxx +++ b/Testing/Code/IO/otbKMLVectorDataIONew.cxx @@ -21,7 +21,7 @@ int otbKMLVectorDataIONew(int argc, char * argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::KMLVectorDataIO<VectorDataType> KMLVectorDataIOType; KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); diff --git a/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx b/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx index 8880a467e9..9bbc112d45 100644 --- a/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx +++ b/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx @@ -22,15 +22,15 @@ int otbKMLVectorDataIOTestCanRead(int argc, char* argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::KMLVectorDataIO<VectorDataType> KMLVectorDataIOType; KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); - bool lCanRead = object->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::KMLVectorDataIO : impossible to open the file "<<argv[1]<<"."<<std::endl; + bool lCanRead = object->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::KMLVectorDataIO : impossible to open the file " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx b/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx index 298f78cebd..3ad64e5d23 100644 --- a/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx @@ -22,15 +22,15 @@ int otbKMLVectorDataIOTestCanWrite(int argc, char* argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::KMLVectorDataIO<VectorDataType> KMLVectorDataIOType; KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); - bool lCanWrite = object->CanWriteFile(argv[1]); - if ( lCanWrite == false) - { - std::cerr << "Erreur otb::KMLVectorDataIO : impossible to create the file "<<argv[1]<<"."<<std::endl; + bool lCanWrite = object->CanWriteFile(argv[1]); + if (lCanWrite == false) + { + std::cerr << "Erreur otb::KMLVectorDataIO : impossible to create the file " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbKMLVectorDataIOTestFileReader.cxx b/Testing/Code/IO/otbKMLVectorDataIOTestFileReader.cxx index 818bf6bdfa..c308df8960 100644 --- a/Testing/Code/IO/otbKMLVectorDataIOTestFileReader.cxx +++ b/Testing/Code/IO/otbKMLVectorDataIOTestFileReader.cxx @@ -22,36 +22,34 @@ int otbKMLVectorDataIOTestFileReader(int argc, char* argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::KMLVectorDataIO<VectorDataType> KMLVectorDataIOType; - typedef VectorDataType::Pointer VectorDataPointerType; - + typedef VectorDataType::Pointer VectorDataPointerType; KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); - VectorDataPointerType data = VectorDataType::New(); - + VectorDataPointerType data = VectorDataType::New(); bool lCanRead = object->CanReadFile(argv[1]); - if (lCanRead==false) - { + if (lCanRead == false) + { return EXIT_FAILURE; - } + } object->SetFileName(argv[1]); object->Read(data); VectorDataType::ConstPointer constData = static_cast<const VectorDataType *>(data); - if (argc>2) - { - bool lCanWrite = object->CanWriteFile(argv[2]); - if (lCanWrite==false) + if (argc > 2) { + bool lCanWrite = object->CanWriteFile(argv[2]); + if (lCanWrite == false) + { return EXIT_FAILURE; - } + } object->SetFileName(argv[2]); object->Write(constData); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx b/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx index 00ed8b598d..8d600f8c45 100644 --- a/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx @@ -27,13 +27,12 @@ int otbLUMImageIOTestCanRead(int argc, char* argv[]) { otb::LUMImageIO::Pointer lLUMImageIO = otb::LUMImageIO::New(); - bool lCanRead = lLUMImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::LUMImageIO : impossible d'ouvrir l'image LUM "<<argv[1]<<"."<<std::endl; + bool lCanRead = lLUMImageIO->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::LUMImageIO : impossible d'ouvrir l'image LUM " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx b/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx index 9238170cd1..9d1a252c68 100644 --- a/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx @@ -27,13 +27,12 @@ int otbLUMImageIOTestCanWrite(int argc, char* argv[]) { otb::LUMImageIO::Pointer lLUMImageIO = otb::LUMImageIO::New(); - bool lCanRead = lLUMImageIO->CanWriteFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::L'image "<<argv[1]<<" n'est pas une image LUM."<<std::endl; + bool lCanRead = lLUMImageIO->CanWriteFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::L'image " << argv[1] << " n'est pas une image LUM." << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx b/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx index 7c521da5c4..b15fefa198 100644 --- a/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx @@ -27,12 +27,12 @@ int otbMSTARImageIOTestCanRead(int argc, char* argv[]) { otb::MSTARImageIO::Pointer lMSTARImageIO = otb::MSTARImageIO::New(); - bool lCanRead = lMSTARImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::MSTARImageIO : impossible d'ouvrir l'image MSTAR "<<argv[1]<<"."<<std::endl; + bool lCanRead = lMSTARImageIO->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::MSTARImageIO : impossible d'ouvrir l'image MSTAR " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbMWImageIOTestCanRead.cxx b/Testing/Code/IO/otbMWImageIOTestCanRead.cxx index 31f7d57b3a..97cff340b4 100644 --- a/Testing/Code/IO/otbMWImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbMWImageIOTestCanRead.cxx @@ -27,13 +27,12 @@ int otbMWImageIOTestCanRead(int argc, char* argv[]) { otb::MWImageIO::Pointer lMWImageIO = otb::MWImageIO::New(); - bool lCanRead = lMWImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Error otb::MWImageIO : impossible to read MW image "<<argv[1]<<"."<<std::endl; + bool lCanRead = lMWImageIO->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Error otb::MWImageIO : impossible to read MW image " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbMWImageIOTestCanWrite.cxx b/Testing/Code/IO/otbMWImageIOTestCanWrite.cxx index aa3d187783..617bfee3f4 100644 --- a/Testing/Code/IO/otbMWImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbMWImageIOTestCanWrite.cxx @@ -27,13 +27,12 @@ int otbMWImageIOTestCanWrite(int argc, char* argv[]) { otb::MWImageIO::Pointer lMWImageIO = otb::MWImageIO::New(); - bool lCanRead = lMWImageIO->CanWriteFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Error image "<<argv[1]<<" is not a MW image."<<std::endl; + bool lCanRead = lMWImageIO->CanWriteFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Error image " << argv[1] << " is not a MW image." << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbOGRVectorDataIOCanRead.cxx b/Testing/Code/IO/otbOGRVectorDataIOCanRead.cxx index 7aa9b5dd0f..d7617ab809 100644 --- a/Testing/Code/IO/otbOGRVectorDataIOCanRead.cxx +++ b/Testing/Code/IO/otbOGRVectorDataIOCanRead.cxx @@ -22,15 +22,15 @@ int otbOGRVectorDataIOTestCanRead(int argc, char* argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::OGRVectorDataIO<VectorDataType> OGRVectorDataIOType; OGRVectorDataIOType::Pointer object = OGRVectorDataIOType::New(); - bool lCanRead = object->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::OGRVectorDataIO : impossible to open the file "<<argv[1]<<"."<<std::endl; + bool lCanRead = object->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::OGRVectorDataIO : impossible to open the file " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbOGRVectorDataIOCanWrite.cxx b/Testing/Code/IO/otbOGRVectorDataIOCanWrite.cxx index 11ec1754a5..5a4b83caf4 100644 --- a/Testing/Code/IO/otbOGRVectorDataIOCanWrite.cxx +++ b/Testing/Code/IO/otbOGRVectorDataIOCanWrite.cxx @@ -22,15 +22,15 @@ int otbOGRVectorDataIOCanWrite(int argc, char* argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::OGRVectorDataIO<VectorDataType> OGRVectorDataIOType; OGRVectorDataIOType::Pointer object = OGRVectorDataIOType::New(); - bool lCanWrite = object->CanWriteFile(argv[1]); - if ( lCanWrite == false) - { - std::cerr << "Erreur otb::OGRVectorDataIO : impossible to create the file "<<argv[1]<<"."<<std::endl; + bool lCanWrite = object->CanWriteFile(argv[1]); + if (lCanWrite == false) + { + std::cerr << "Erreur otb::OGRVectorDataIO : impossible to create the file " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbOGRVectorDataIONew.cxx b/Testing/Code/IO/otbOGRVectorDataIONew.cxx index 24e3ef45a9..c55c483635 100644 --- a/Testing/Code/IO/otbOGRVectorDataIONew.cxx +++ b/Testing/Code/IO/otbOGRVectorDataIONew.cxx @@ -21,7 +21,7 @@ int otbOGRVectorDataIONew(int argc, char * argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::OGRVectorDataIO<VectorDataType> OGRVectorDataIOType; OGRVectorDataIOType::Pointer object = OGRVectorDataIOType::New(); diff --git a/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx b/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx index dbeacea30e..b04596cc76 100644 --- a/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx @@ -27,12 +27,12 @@ int otbONERAImageIOTestCanRead(int argc, char* argv[]) { otb::ONERAImageIO::Pointer lONERAImageIO = otb::ONERAImageIO::New(); - bool lCanRead = lONERAImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::ONERAImageIO : impossible d'ouvrir l'image "<<argv[1]<<"."<<std::endl; + bool lCanRead = lONERAImageIO->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::ONERAImageIO : impossible d'ouvrir l'image " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbOssimElevManagerTest.cxx b/Testing/Code/IO/otbOssimElevManagerTest.cxx index b83a05c138..6204ffc9e8 100644 --- a/Testing/Code/IO/otbOssimElevManagerTest.cxx +++ b/Testing/Code/IO/otbOssimElevManagerTest.cxx @@ -22,44 +22,43 @@ #include "base/ossimFilename.h" #include "itkImageRegionIteratorWithIndex.h" - -int otbOssimElevManagerTest(int argc,char* argv[]) +int otbOssimElevManagerTest(int argc, char* argv[]) { - if (argc!=9) - { - std::cout<<"Usage: "<<std::endl; - std::cout<<argv[0]<<" srtmDir outfname originX originY spacingX spacingY sizeX sizeY"<<std::endl; + if (argc != 9) + { + std::cout << "Usage: " << std::endl; + std::cout << argv[0] << " srtmDir outfname originX originY spacingX spacingY sizeX sizeY" << std::endl; return EXIT_FAILURE; - } + } const ossimFilename srtmDir(argv[1]); - const char * outfname = argv[2]; + const char * outfname = argv[2]; typedef double PixelType; const unsigned int Dimension = 2; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileWriter<ImageType> WriterType; typedef itk::ImageRegionIteratorWithIndex<ImageType> IteratorType; - typedef ImageType::PointType PoinType; - typedef ImageType::RegionType RegionType; + typedef ImageType::PointType PoinType; + typedef ImageType::RegionType RegionType; typedef ImageType::SpacingType SpacingType; - typedef RegionType::IndexType IndexType; - typedef RegionType::SizeType SizeType; - typedef ImageType::PointType PointType; + typedef RegionType::IndexType IndexType; + typedef RegionType::SizeType SizeType; + typedef ImageType::PointType PointType; - PointType origin; + PointType origin; SpacingType spacing; - SizeType size; + SizeType size; - origin[0]= atof(argv[3]); - origin[1]= atof(argv[4]); - spacing[0]=atof(argv[5]); - spacing[1]=atof(argv[6]); - size[0]= atoi(argv[7]); - size[1]= atoi(argv[8]); + origin[0] = atof(argv[3]); + origin[1] = atof(argv[4]); + spacing[0] = atof(argv[5]); + spacing[1] = atof(argv[6]); + size[0] = atoi(argv[7]); + size[1] = atoi(argv[8]); IndexType index; index.Fill(0); @@ -80,34 +79,33 @@ int otbOssimElevManagerTest(int argc,char* argv[]) elevManager->loadElevationPath(srtmDir); - IteratorType it(image,image->GetLargestPossibleRegion()); + IteratorType it(image, image->GetLargestPossibleRegion()); - for (it.GoToBegin();!it.IsAtEnd();++it) - { + for (it.GoToBegin(); !it.IsAtEnd(); ++it) + { PointType point; - image->TransformIndexToPhysicalPoint(it.GetIndex(),point); + image->TransformIndexToPhysicalPoint(it.GetIndex(), point); ossimGpt ossimWorldPoint; - ossimWorldPoint.lon=point[0]; - ossimWorldPoint.lat=point[1]; + ossimWorldPoint.lon = point[0]; + ossimWorldPoint.lat = point[1]; double height = elevManager->getHeightAboveMSL(ossimWorldPoint); if (!ossim::isnan(height)) - { + { // Fill the image it.Set(height); - } + } else - { + { // Back to the MNT default value it.Set(0); + } } - } WriterType::Pointer writer = WriterType::New(); writer->SetInput(image); writer->SetFileName(outfname); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbOssimElevManagerTest2.cxx b/Testing/Code/IO/otbOssimElevManagerTest2.cxx index 716b4b3d20..cfa16b6068 100644 --- a/Testing/Code/IO/otbOssimElevManagerTest2.cxx +++ b/Testing/Code/IO/otbOssimElevManagerTest2.cxx @@ -23,32 +23,31 @@ #include "base/ossimFilename.h" #include "itkPoint.h" -int otbOssimElevManagerTest2(int argc,char* argv[]) +int otbOssimElevManagerTest2(int argc, char* argv[]) { - if (argc!=7) - { - std::cout<<"Usage: "<<std::endl; - std::cout<<argv[0]<<" srtmDir outfname originX originY spacingX sizeX "<<std::endl; + if (argc != 7) + { + std::cout << "Usage: " << std::endl; + std::cout << argv[0] << " srtmDir outfname originX originY spacingX sizeX " << std::endl; return EXIT_FAILURE; - } + } const ossimFilename srtmDir(argv[1]); - const char * outfname = argv[2]; + const char * outfname = argv[2]; typedef double PixelType; - typedef itk::Point<double,2> PointType; + typedef itk::Point<double, 2> PointType; PointType origin; - double spacing; - int size; + double spacing; + int size; origin[0] = atof(argv[3]); origin[1] = atof(argv[4]); spacing = atof(argv[5]); size = atoi(argv[6]); - ossimElevManager * elevManager = ossimElevManager::instance(); elevManager->loadElevationPath(srtmDir); @@ -56,17 +55,17 @@ int otbOssimElevManagerTest2(int argc,char* argv[]) std::ofstream file; file.open(outfname); - for (int i = 0; i<size; i++) - { + for (int i = 0; i < size; i++) + { PointType point; - point[0] = origin[0] + i*spacing; + point[0] = origin[0] + i * spacing; point[1] = origin[1]; ossimGpt ossimWorldPoint; - ossimWorldPoint.lon=point[0]; - ossimWorldPoint.lat=point[1]; + ossimWorldPoint.lon = point[0]; + ossimWorldPoint.lat = point[1]; double height = elevManager->getHeightAboveMSL(ossimWorldPoint); file << point << " -> " << height << std::endl; - } + } file.close(); diff --git a/Testing/Code/IO/otbOssimElevManagerTest4.cxx b/Testing/Code/IO/otbOssimElevManagerTest4.cxx index 1c5c492754..d472f5ab76 100644 --- a/Testing/Code/IO/otbOssimElevManagerTest4.cxx +++ b/Testing/Code/IO/otbOssimElevManagerTest4.cxx @@ -23,77 +23,75 @@ #include "elevation/ossimElevManager.h" #include "base/ossimFilename.h" - -int otbOssimElevManagerTest4(int argc,char* argv[]) +int otbOssimElevManagerTest4(int argc, char* argv[]) { - if (argc!=9) - { - std::cout<<"Usage: "<<std::endl; - std::cout<<argv[0]<<" srtmDir outfname originX originY spacingX spacingY sizeX sizeY"<<std::endl; + if (argc != 9) + { + std::cout << "Usage: " << std::endl; + std::cout << argv[0] << " srtmDir outfname originX originY spacingX spacingY sizeX sizeY" << std::endl; return EXIT_FAILURE; - } + } const ossimFilename srtmDir(argv[1]); - const char * outfname = argv[2]; + const char * outfname = argv[2]; double origin[2]; double spacing[2]; - int size[2]; + int size[2]; + + origin[0] = atof(argv[3]); + origin[1] = atof(argv[4]); + spacing[0] = atof(argv[5]); + spacing[1] = atof(argv[6]); + size[0] = atoi(argv[7]); + size[1] = atoi(argv[8]); - origin[0]= atof(argv[3]); - origin[1]= atof(argv[4]); - spacing[0]=atof(argv[5]); - spacing[1]=atof(argv[6]); - size[0]= atoi(argv[7]); - size[1]= atoi(argv[8]); + double* image = new double[size[0] * size[1]]; - double* image = new double[size[0]*size[1]]; - ossimElevManager * elevManager = ossimElevManager::instance(); elevManager->loadElevationPath(srtmDir); - for (int j=0; j<size[1]; ++j) - { - for (int i=0; i<size[0]; ++i) + for (int j = 0; j < size[1]; ++j) { + for (int i = 0; i < size[0]; ++i) + { double point[2]; - point[0] = origin[0]+i*spacing[0]; - point[1] = origin[1]+j*spacing[1]; + point[0] = origin[0] + i * spacing[0]; + point[1] = origin[1] + j * spacing[1]; ossimGpt ossimWorldPoint; - ossimWorldPoint.lon=point[0]; - ossimWorldPoint.lat=point[1]; + ossimWorldPoint.lon = point[0]; + ossimWorldPoint.lat = point[1]; double height = elevManager->getHeightAboveMSL(ossimWorldPoint); - + if (!ossim::isnan(height)) - { + { // Fill the image - image[i+j*size[0]] = height; - } + image[i + j * size[0]] = height; + } else - { + { // Back to the MNT default value - image[i+j*size[0]] = 0; + image[i + j * size[0]] = 0; + } } } - } std::ofstream file; - std::cout<<outfname<<std::endl; - file.open(outfname, ios::binary|ios::out); + std::cout << outfname << std::endl; + file.open(outfname, ios::binary | ios::out); - file.write(reinterpret_cast<char*>(image), sizeof(double)*size[0]*size[1]); + file.write(reinterpret_cast<char*>(image), sizeof(double) * size[0] * size[1]); file.close(); - delete[] image; //Create the header std::stringstream headerName; headerName << outfname << ".hdr"; - std::ofstream headerFile; + std::ofstream headerFile; headerFile.open(headerName.str().c_str()); headerFile << "ENVI" << std::endl; headerFile << "samples = " << size[0] << std::endl; @@ -107,23 +105,22 @@ int otbOssimElevManagerTest4(int argc,char* argv[]) headerFile << std::endl; headerFile.close(); - //Check for the index 216,51 (difference of 4 in the output) - { - int i = 216; - int j = 51; + { + int i = 216; + int j = 51; double point[2]; - point[0] = origin[0]+i*spacing[0]; - point[1] = origin[1]+j*spacing[1]; + point[0] = origin[0] + i * spacing[0]; + point[1] = origin[1] + j * spacing[1]; ossimGpt ossimWorldPoint; - ossimWorldPoint.lon=point[0]; - ossimWorldPoint.lat=point[1]; + ossimWorldPoint.lon = point[0]; + ossimWorldPoint.lat = point[1]; double height = elevManager->getHeightAboveMSL(ossimWorldPoint); std::cout << "Output value at (216,51): " << height << std::endl; std::cout << "At lon: " << ossimWorldPoint.lon << " , lat: " << ossimWorldPoint.lat << std::endl; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbOssimJpegFileRessourceLeakTest.cxx b/Testing/Code/IO/otbOssimJpegFileRessourceLeakTest.cxx index 3d442a2426..5163cd4683 100644 --- a/Testing/Code/IO/otbOssimJpegFileRessourceLeakTest.cxx +++ b/Testing/Code/IO/otbOssimJpegFileRessourceLeakTest.cxx @@ -25,23 +25,23 @@ int otbOssimJpegFileRessourceLeakTest(int argc, char * argv[]) { - if(argc != 3) + if (argc != 3) { - std::cerr<<"Usage:"<<std::endl; - std::cerr<<argv[0]<<" infname nbReading"<<std::endl; + std::cerr << "Usage:" << std::endl; + std::cerr << argv[0] << " infname nbReading" << std::endl; return 1; } - const char * infname = argv[1]; + const char * infname = argv[1]; const unsigned int nbReading = atoi(argv[2]); - for(unsigned int i = 0; i < nbReading; ++i) + for (unsigned int i = 0; i < nbReading; ++i) { // Create the handler ossimImageHandler * handler = ossimImageHandlerRegistry::instance()->open(ossimFilename(infname)); - if(!handler) + if (!handler) { - std::cerr<<"Failed to open image "<<i<<" times."<<std::endl; + std::cerr << "Failed to open image " << i << " times." << std::endl; return 1; } handler->close(); diff --git a/Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx b/Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx index debd63940b..1095699be4 100644 --- a/Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx +++ b/Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx @@ -20,41 +20,39 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbImageFileReader.h" #include "otbVectorImage.h" #include "itkRGBPixel.h" #include "itkExceptionObject.h" #include <iostream> - int otbPNGIndexedNbBandsTest(int argc, char* argv[]) { // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; + const char * inputFilename = argv[1]; const unsigned int nbBands = atoi(argv[2]); - typedef itk::RGBPixel<unsigned char> InputPixelType; - const unsigned int Dimension = 2; + typedef itk::RGBPixel<unsigned char> InputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); - + reader->SetFileName(inputFilename); + reader->UpdateOutputInformation(); - if ( reader->GetOutput()->GetNumberOfComponentsPerPixel() == nbBands ) - { - return EXIT_SUCCESS; - } + if (reader->GetOutput()->GetNumberOfComponentsPerPixel() == nbBands) + { + return EXIT_SUCCESS; + } else - { - std::cout << "Read " << reader->GetOutput()->GetNumberOfComponentsPerPixel() << " but the real number of bands is " << nbBands <<std::endl; - return EXIT_FAILURE; - } + { + std::cout << "Read " << reader->GetOutput()->GetNumberOfComponentsPerPixel() << + " but the real number of bands is " << nbBands << std::endl; + return EXIT_FAILURE; + } } - diff --git a/Testing/Code/IO/otbPipeline.cxx b/Testing/Code/IO/otbPipeline.cxx index 0a321718dc..5649a0e884 100644 --- a/Testing/Code/IO/otbPipeline.cxx +++ b/Testing/Code/IO/otbPipeline.cxx @@ -22,7 +22,7 @@ int otbPipeline(int argc, char * argv[]) { - typedef otb::Image<unsigned char, 2> ImageType; + typedef otb::Image<unsigned char, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); typedef otb::StreamingImageFileWriter<ImageType> WriterType; @@ -34,5 +34,3 @@ int otbPipeline(int argc, char * argv[]) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx b/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx index 6062f71086..9d0816ab6a 100644 --- a/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx +++ b/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx @@ -33,26 +33,26 @@ int otbPipelineMetadataHandlingTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::DiscreteGaussianImageFilter<InputImageType,OutputImageType> FilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef itk::DiscreteGaussianImageFilter<InputImageType, OutputImageType> FilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetInput(reader->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; diff --git a/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx b/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx index 1498e7eb9a..6345c0a6fb 100644 --- a/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx +++ b/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx @@ -33,28 +33,27 @@ int otbPipelineMetadataHandlingWithUFFilterTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter<InputImageType,OutputImageType> FilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> FilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetInput(reader->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbPointSetFileReader.cxx b/Testing/Code/IO/otbPointSetFileReader.cxx index 965ceabe86..ba3a2fc761 100644 --- a/Testing/Code/IO/otbPointSetFileReader.cxx +++ b/Testing/Code/IO/otbPointSetFileReader.cxx @@ -23,7 +23,7 @@ int otbPointSetFileReader(int argc, char * argv[]) { - typedef itk::PointSet <double, 2> PointSetType; + typedef itk::PointSet <double, 2> PointSetType; typedef otb::PointSetFileReader<PointSetType> PointSetFileReaderType; PointSetFileReaderType::Pointer reader = PointSetFileReaderType::New(); @@ -32,22 +32,20 @@ int otbPointSetFileReader(int argc, char * argv[]) PointSetType::Pointer data = reader->GetOutput(); - std::ofstream fout (argv[2]); unsigned long nPoints = data->GetNumberOfPoints(); fout << std::setprecision(15) << "Number of points: " << nPoints << std::endl; - for (unsigned long i=0; i < nPoints; ++i) - { + for (unsigned long i = 0; i < nPoints; ++i) + { PointSetType::PointType point; - data->GetPoint(i,&point); + data->GetPoint(i, &point); fout << point << " : "; PointSetType::PixelType value(itk::NumericTraits<PointSetType::PixelType>::Zero); - data->GetPointData(i,&value); + data->GetPointData(i, &value); fout << value << std::endl; - } + } fout << std::endl; fout.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbPointSetFileReader2.cxx b/Testing/Code/IO/otbPointSetFileReader2.cxx index ae952b218a..459becf565 100644 --- a/Testing/Code/IO/otbPointSetFileReader2.cxx +++ b/Testing/Code/IO/otbPointSetFileReader2.cxx @@ -23,7 +23,7 @@ int otbPointSetFileReader2(int argc, char * argv[]) { - typedef itk::PointSet <double, 3> PointSetType; + typedef itk::PointSet <double, 3> PointSetType; typedef otb::PointSetFileReader<PointSetType> PointSetFileReaderType; PointSetFileReaderType::Pointer reader = PointSetFileReaderType::New(); @@ -32,22 +32,20 @@ int otbPointSetFileReader2(int argc, char * argv[]) PointSetType::Pointer data = reader->GetOutput(); - std::ofstream fout (argv[2]); unsigned long nPoints = data->GetNumberOfPoints(); fout << std::setprecision(15) << "Number of points: " << nPoints << std::endl; - for (unsigned long i=0; i < nPoints; ++i) - { + for (unsigned long i = 0; i < nPoints; ++i) + { PointSetType::PointType point; - data->GetPoint(i,&point); + data->GetPoint(i, &point); fout << point << " : "; PointSetType::PixelType value(itk::NumericTraits<PointSetType::PixelType>::Zero); - data->GetPointData(i,&value); + data->GetPointData(i, &value); fout << value << std::endl; - } + } fout << std::endl; fout.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbPointSetFileReaderNew.cxx b/Testing/Code/IO/otbPointSetFileReaderNew.cxx index abd289d6cf..c57cd630e3 100644 --- a/Testing/Code/IO/otbPointSetFileReaderNew.cxx +++ b/Testing/Code/IO/otbPointSetFileReaderNew.cxx @@ -21,10 +21,9 @@ int otbPointSetFileReaderNew(int argc, char * argv[]) { - typedef itk::PointSet <double, 2> PointSetType; + typedef itk::PointSet <double, 2> PointSetType; typedef otb::PointSetFileReader<PointSetType> PointSetFileReaderType; PointSetFileReaderType::Pointer object = PointSetFileReaderType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbPrepareSRTMDirectoryNew.cxx b/Testing/Code/IO/otbPrepareSRTMDirectoryNew.cxx index 2e636e2d2c..13b261133b 100644 --- a/Testing/Code/IO/otbPrepareSRTMDirectoryNew.cxx +++ b/Testing/Code/IO/otbPrepareSRTMDirectoryNew.cxx @@ -18,16 +18,12 @@ #include "itkExceptionObject.h" #include "otbPrepareSRTMDirectory.h" - int otbPrepareSRTMDirectoryNew(int argc, char * argv[]) { - typedef otb::PrepareSRTMDirectory PrepareSRTMDirectoryType; + typedef otb::PrepareSRTMDirectory PrepareSRTMDirectoryType; PrepareSRTMDirectoryType::Pointer prepareSRTM = PrepareSRTMDirectoryType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/IO/otbPrepareSRTMDirectoryTest.cxx b/Testing/Code/IO/otbPrepareSRTMDirectoryTest.cxx index 67a09bdcbe..8c267819bf 100644 --- a/Testing/Code/IO/otbPrepareSRTMDirectoryTest.cxx +++ b/Testing/Code/IO/otbPrepareSRTMDirectoryTest.cxx @@ -18,23 +18,20 @@ #include "itkExceptionObject.h" #include "otbPrepareSRTMDirectory.h" - int otbPrepareSRTMDirectoryTest(int argc, char * argv[]) { typedef otb::PrepareSRTMDirectory PrepareSRTMDirectoryType; PrepareSRTMDirectoryType::Pointer prepareSRTM = PrepareSRTMDirectoryType::New(); - prepareSRTM->SetFullDEMDirectoryPath( argv[1] ); - prepareSRTM->SetDEMDirectoryPath( argv[2] ); - prepareSRTM->SetULLon( atof(argv[3]) ); - prepareSRTM->SetULLat( atof(argv[4]) ); - prepareSRTM->SetLRLon( atof(argv[5]) ); - prepareSRTM->SetLRLat( atof(argv[6]) ); + prepareSRTM->SetFullDEMDirectoryPath(argv[1]); + prepareSRTM->SetDEMDirectoryPath(argv[2]); + prepareSRTM->SetULLon(atof(argv[3])); + prepareSRTM->SetULLat(atof(argv[4])); + prepareSRTM->SetLRLon(atof(argv[5])); + prepareSRTM->SetLRLat(atof(argv[6])); prepareSRTM->Evaluate(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/IO/otbQuickBirdImageMetadataInterfaceNew.cxx b/Testing/Code/IO/otbQuickBirdImageMetadataInterfaceNew.cxx index a959d3789f..d65a4f2584 100644 --- a/Testing/Code/IO/otbQuickBirdImageMetadataInterfaceNew.cxx +++ b/Testing/Code/IO/otbQuickBirdImageMetadataInterfaceNew.cxx @@ -26,8 +26,7 @@ #include "otbQuickBirdImageMetadataInterface.h" - -int otbQuickBirdImageMetadataInterfaceNew (int argc, char* argv[]) +int otbQuickBirdImageMetadataInterfaceNew(int argc, char* argv[]) { otb::QuickBirdImageMetadataInterface::Pointer lImageMetadata = otb::QuickBirdImageMetadataInterface::New(); diff --git a/Testing/Code/IO/otbRADImageIOTestCanRead.cxx b/Testing/Code/IO/otbRADImageIOTestCanRead.cxx index 6018ec2299..b170da5ba8 100644 --- a/Testing/Code/IO/otbRADImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbRADImageIOTestCanRead.cxx @@ -27,13 +27,12 @@ int otbRADImageIOTestCanRead(int argc, char* argv[]) { otb::RADImageIO::Pointer lRADImageIO = otb::RADImageIO::New(); - bool lCanRead = lRADImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::RADImageIO : impossible to read file: "<<argv[1]<<"."<<std::endl; + bool lCanRead = lRADImageIO->CanReadFile(argv[1]); + if (lCanRead == false) + { + std::cerr << "Erreur otb::RADImageIO : impossible to read file: " << argv[1] << "." << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbReadingComplexDataIntoComplexImageTest.cxx b/Testing/Code/IO/otbReadingComplexDataIntoComplexImageTest.cxx index 0134ecb18d..851982bd1b 100644 --- a/Testing/Code/IO/otbReadingComplexDataIntoComplexImageTest.cxx +++ b/Testing/Code/IO/otbReadingComplexDataIntoComplexImageTest.cxx @@ -22,22 +22,22 @@ #include "otbVectorImage.h" #include "otbMacro.h" -int otbReadingComplexDataIntoComplexImageTest(int argc,char * argv[]) +int otbReadingComplexDataIntoComplexImageTest(int argc, char * argv[]) { - typedef double RealType; - typedef std::complex<RealType> PixelType; - typedef otb::Image<PixelType,2> ImageType; - typedef otb::VectorImage<RealType,2> VectorImageType; - typedef otb::ImageFileReader<ImageType> Reader1Type; + typedef double RealType; + typedef std::complex<RealType> PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::VectorImage<RealType, 2> VectorImageType; + typedef otb::ImageFileReader<ImageType> Reader1Type; typedef otb::ImageFileReader<VectorImageType> Reader2Type; ImageType::IndexType index; - index[0]=atoi(argv[2]); - index[1]=atoi(argv[3]); + index[0] = atoi(argv[2]); + index[1] = atoi(argv[3]); ImageType::SizeType size; - size[0]=1; - size[1]=1; + size[0] = 1; + size[1] = 1; ImageType::RegionType region; region.SetSize(size); @@ -63,12 +63,16 @@ int otbReadingComplexDataIntoComplexImageTest(int argc,char * argv[]) VectorImageType::PixelType vectorValue = reader2->GetOutput()->GetPixel(index); - std::cout<<"Image value (complex): "<<complexValue<<std::endl; - std::cout<<"Image value (vector ): "<<vectorValue<<std::endl; + std::cout << "Image value (complex): " << complexValue << std::endl; + std::cout << "Image value (vector ): " << vectorValue << std::endl; - otbControlConditionTestMacro(vectorValue.Size()<2,"VectorImage has less than 2 components. No input complex data."); - otbControlConditionTestMacro(complexValue.real()!=vectorValue[0],"The real part is not read properly. Have a look at the file itk::ConvertPixelBuffer, the problem might be there."); - otbControlConditionTestMacro(complexValue.imag()!=vectorValue[1],"The imaginary part is not read properly. Have a look at the file itk::ConvertPixelBuffer, the problem might be there."); + otbControlConditionTestMacro(vectorValue.Size() < 2, "VectorImage has less than 2 components. No input complex data."); + otbControlConditionTestMacro( + complexValue.real() != vectorValue[0], + "The real part is not read properly. Have a look at the file itk::ConvertPixelBuffer, the problem might be there."); + otbControlConditionTestMacro( + complexValue.imag() != vectorValue[1], + "The imaginary part is not read properly. Have a look at the file itk::ConvertPixelBuffer, the problem might be there."); return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbShortImageIOTest.cxx b/Testing/Code/IO/otbShortImageIOTest.cxx index 3368c2f592..fb83c2b1a3 100644 --- a/Testing/Code/IO/otbShortImageIOTest.cxx +++ b/Testing/Code/IO/otbShortImageIOTest.cxx @@ -33,26 +33,24 @@ int otbShortImageIOTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef short InputPixelType; - typedef short OutputPixelType; - const unsigned int Dimension = 2; + typedef short InputPixelType; + typedef short OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbShortRGBImageIOTest.cxx b/Testing/Code/IO/otbShortRGBImageIOTest.cxx index afd7546d0b..56f635bb17 100644 --- a/Testing/Code/IO/otbShortRGBImageIOTest.cxx +++ b/Testing/Code/IO/otbShortRGBImageIOTest.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbImageFileWriter.h" #include "otbImageFileReader.h" #include "otbImage.h" @@ -28,33 +27,30 @@ #include "itkExceptionObject.h" #include <iostream> - int otbShortRGBImageIOTest(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef itk::RGBPixel<short> InputPixelType; - typedef itk::RGBPixel<short> OutputPixelType; - const unsigned int Dimension = 2; + typedef itk::RGBPixel<short> InputPixelType; + typedef itk::RGBPixel<short> OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbSpatialObjectDXFReader.cxx b/Testing/Code/IO/otbSpatialObjectDXFReader.cxx index 6cd7a3f34f..c05ef2d3b9 100644 --- a/Testing/Code/IO/otbSpatialObjectDXFReader.cxx +++ b/Testing/Code/IO/otbSpatialObjectDXFReader.cxx @@ -25,100 +25,95 @@ int otbSpatialObjectDXFReader(int argc, char * argv[]) { const unsigned int Dimension = 2; - char * inputFilename = argv[1]; - char * outputFilename = argv[2]; + char * inputFilename = argv[1]; + char * outputFilename = argv[2]; const unsigned int outputSize = atoi(argv[4]); - typedef double PixelType; - typedef unsigned char OutputPixelType; - typedef itk::GroupSpatialObject<Dimension> GroupType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::SpatialObjectDXFReader<GroupType> SpatialObjectDXFReaderType; - typedef otb::SpatialObjectToImageDrawingFilter<GroupType,ImageType> SpatialObjectToImageDrawingFilterType; - typedef itk::RescaleIntensityImageFilter< ImageType, OutputImageType > CastFilterType; - typedef itk::SpatialObject<Dimension> SpatialObjectType; + typedef double PixelType; + typedef unsigned char OutputPixelType; + typedef itk::GroupSpatialObject<Dimension> GroupType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::SpatialObjectDXFReader<GroupType> SpatialObjectDXFReaderType; + typedef otb::SpatialObjectToImageDrawingFilter<GroupType, ImageType> SpatialObjectToImageDrawingFilterType; + typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> CastFilterType; + typedef itk::SpatialObject<Dimension> SpatialObjectType; // Instantiating object - SpatialObjectDXFReaderType::Pointer reader = SpatialObjectDXFReaderType::New(); + SpatialObjectDXFReaderType::Pointer reader = SpatialObjectDXFReaderType::New(); SpatialObjectToImageDrawingFilterType::Pointer imageGenerator = SpatialObjectToImageDrawingFilterType::New(); - WriterType::Pointer writer = WriterType::New(); - CastFilterType::Pointer castFilter = CastFilterType::New(); + WriterType::Pointer writer = WriterType::New(); + CastFilterType::Pointer castFilter = CastFilterType::New(); reader->SetFileName(inputFilename); reader->SetLayerName(argv[3]); - reader->Update(); GroupType::Pointer group = reader->GetOutput(); if (group->GetNumberOfChildren() != 0) - { + { /** Writing image **/ - SpatialObjectType::ChildrenListType* children=group->GetChildren(0); + SpatialObjectType::ChildrenListType* children = group->GetChildren(0); SpatialObjectType::ChildrenListType::iterator it = children->begin(); SpatialObjectType::ChildrenListType::iterator end = children->end(); - double maximum[Dimension],minimum[Dimension]; + double maximum[Dimension], minimum[Dimension]; (*it)->ComputeBoundingBox(); - minimum[0]=(*it)->GetBoundingBox()->GetMinimum()[0]; - minimum[1]=(*it)->GetBoundingBox()->GetMinimum()[1]; + minimum[0] = (*it)->GetBoundingBox()->GetMinimum()[0]; + minimum[1] = (*it)->GetBoundingBox()->GetMinimum()[1]; while (it != end) - { + { (*it)->ComputeBoundingBox(); if ((*it)->GetBoundingBox()->GetMinimum()[0] < minimum[0]) - { - minimum[0]=(*it)->GetBoundingBox()->GetMinimum()[0]; - } + { + minimum[0] = (*it)->GetBoundingBox()->GetMinimum()[0]; + } if ((*it)->GetBoundingBox()->GetMinimum()[1] < minimum[1]) - { - minimum[1]=(*it)->GetBoundingBox()->GetMinimum()[1]; - } + { + minimum[1] = (*it)->GetBoundingBox()->GetMinimum()[1]; + } it++; - } - + } ImageType::SizeType size; - size[0]=outputSize; - size[1]=outputSize; + size[0] = outputSize; + size[1] = outputSize; imageGenerator->SetSize(size); ImageType::PointType origin; - origin[0]=(int) minimum[0]; - origin[1]=(int) minimum[1]; + origin[0] = (int) minimum[0]; + origin[1] = (int) minimum[1]; imageGenerator->SetOrigin(origin); group->ComputeBoundingBox(); - maximum[0]=group->GetBoundingBox()->GetMaximum()[0]; - maximum[1]=group->GetBoundingBox()->GetMaximum()[1]; + maximum[0] = group->GetBoundingBox()->GetMaximum()[0]; + maximum[1] = group->GetBoundingBox()->GetMaximum()[1]; ImageType::SpacingType spacing; - spacing[0]=(maximum[0]-origin[0])/size[0]; - spacing[1]=(maximum[1]-origin[1])/size[1]; + spacing[0] = (maximum[0] - origin[0]) / size[0]; + spacing[1] = (maximum[1] - origin[1]) / size[1]; imageGenerator->SetSpacing(spacing); - imageGenerator->SetInput(group); - imageGenerator->Update(); - castFilter->SetOutputMinimum( 0 ); - castFilter->SetOutputMaximum( 255 ); - castFilter->SetInput( imageGenerator->GetOutput() ); + castFilter->SetOutputMinimum(0); + castFilter->SetOutputMaximum(255); + castFilter->SetInput(imageGenerator->GetOutput()); writer->SetInput(castFilter->GetOutput()); writer->SetFileName(outputFilename); writer->Update(); - } + } else - { - std::cout<<"No objects detected."<<std::endl; + { + std::cout << "No objects detected." << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbSpatialObjectDXFReaderNew.cxx b/Testing/Code/IO/otbSpatialObjectDXFReaderNew.cxx index 58ca7a0442..4693279cfe 100644 --- a/Testing/Code/IO/otbSpatialObjectDXFReaderNew.cxx +++ b/Testing/Code/IO/otbSpatialObjectDXFReaderNew.cxx @@ -23,7 +23,7 @@ int otbSpatialObjectDXFReaderNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef itk::GroupSpatialObject<Dimension> GroupType; + typedef itk::GroupSpatialObject<Dimension> GroupType; typedef otb::SpatialObjectDXFReader<GroupType> SpatialObjectDXFReaderType; // Instantiating object diff --git a/Testing/Code/IO/otbSpotImageMetadataInterfaceNew.cxx b/Testing/Code/IO/otbSpotImageMetadataInterfaceNew.cxx index 883a3e7a77..f93c5dc759 100644 --- a/Testing/Code/IO/otbSpotImageMetadataInterfaceNew.cxx +++ b/Testing/Code/IO/otbSpotImageMetadataInterfaceNew.cxx @@ -26,8 +26,7 @@ #include "otbSpotImageMetadataInterface.h" - -int otbSpotImageMetadataInterfaceNew (int argc, char* argv[]) +int otbSpotImageMetadataInterfaceNew(int argc, char* argv[]) { otb::SpotImageMetadataInterface::Pointer lImageMetadata = otb::SpotImageMetadataInterface::New(); diff --git a/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx b/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx index ed5b9d987a..4fab387f22 100644 --- a/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx +++ b/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx @@ -29,54 +29,53 @@ #include "otbStreamingImageFileWriter.h" #include "otbImageFileWriter.h" -int otbStreamingImageFileWriterTest (int argc, char* argv[]) +int otbStreamingImageFileWriterTest(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - int iStreaming(::atoi(argv[3])); - bool streaming = (bool)(iStreaming); - int NumberOfStreamDivisions(::atoi(argv[4])); + int iStreaming(::atoi(argv[3])); + bool streaming = (bool) (iStreaming); + int NumberOfStreamDivisions(::atoi(argv[4])); - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> StreamingWriterType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); - if ( streaming == true ) - { - std::cout << "Streaming writing test"<<std::endl; + if (streaming == true) + { + std::cout << "Streaming writing test" << std::endl; StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); - writer->SetInput( reader->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetNumberOfStreamDivisions(NumberOfStreamDivisions); + writer->SetInput(reader->GetOutput()); writer->Update(); - } + } else - { - std::cout << "Writing test"<<std::endl; - WriterType::Pointer writer = WriterType::New(); - if(NumberOfStreamDivisions > 1) { - std::cout << "Streaming testing of otb::ImageFileWriter "<<std::endl; - std::cout << "NumberOfStreamDivisions: "<<NumberOfStreamDivisions<<std::endl; - writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); - } - - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); + std::cout << "Writing test" << std::endl; + WriterType::Pointer writer = WriterType::New(); + if (NumberOfStreamDivisions > 1) + { + std::cout << "Streaming testing of otb::ImageFileWriter " << std::endl; + std::cout << "NumberOfStreamDivisions: " << NumberOfStreamDivisions << std::endl; + writer->SetNumberOfStreamDivisions(NumberOfStreamDivisions); + } + + writer->SetFileName(outputFilename); + writer->SetInput(reader->GetOutput()); writer->Update(); - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx b/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx index e1238948bb..617e38dd94 100644 --- a/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx +++ b/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx @@ -25,67 +25,65 @@ #include "otbImage.h" - #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" -int otbStreamingImageFileWriterTestCalculateNumberOfDivisions (int argc, char* argv[]) +int otbStreamingImageFileWriterTestCalculateNumberOfDivisions(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - std::string MethodCalculateNumberOfStreamDivision(argv[3]); + std::string MethodCalculateNumberOfStreamDivision(argv[3]); - typedef unsigned int PixelType; - const unsigned int Dimension = 2; + typedef unsigned int PixelType; + const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::StreamingImageFileWriter< ImageType> StreamingWriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> StreamingWriterType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); - std::cout << "Streaming writing test"<<std::endl; + std::cout << "Streaming writing test" << std::endl; StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetInput(reader->GetOutput()); - if ( MethodCalculateNumberOfStreamDivision == "AUTOMATIC_NUMBER_OF_STREAM_DIVISIONS" ) - { + if (MethodCalculateNumberOfStreamDivision == "AUTOMATIC_NUMBER_OF_STREAM_DIVISIONS") + { writer->SetAutomaticNumberOfStreamDivisions(); - } - else if ( MethodCalculateNumberOfStreamDivision == "NUMBER_OF_STREAM_DIVISIONS" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "NUMBER_OF_STREAM_DIVISIONS") + { writer->SetNumberOfStreamDivisions(::atoi(argv[4])); - } - else if ( MethodCalculateNumberOfStreamDivision == "BUFFER_MEMORY_SIZE" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "BUFFER_MEMORY_SIZE") + { writer->SetBufferMemorySize(::atoi(argv[4])); - } - else if ( MethodCalculateNumberOfStreamDivision == "BUFFER_NUMBER_OF_LINES" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "BUFFER_NUMBER_OF_LINES") + { writer->SetBufferNumberOfLinesDivisions(::atoi(argv[4])); - } - else if ( MethodCalculateNumberOfStreamDivision == "TILING_STREAM_DIVISIONS" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "TILING_STREAM_DIVISIONS") + { writer->SetTilingStreamDivisions(); - } - else if ( MethodCalculateNumberOfStreamDivision == "TILING_NUMBER_OF_STREAM_DIVISIONS" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "TILING_NUMBER_OF_STREAM_DIVISIONS") + { std::cout << "Number : " << ::atoi(argv[4]) << std::endl; writer->SetTilingStreamDivisions(::atoi(argv[4])); - } - else if ( MethodCalculateNumberOfStreamDivision == "DEFAULT" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "DEFAULT") + { - } + } else - { - itkGenericExceptionMacro(<<"Parameter value not authorized !!!"); - } + { + itkGenericExceptionMacro(<< "Parameter value not authorized !!!"); + } writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx b/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx index 8ba61f80ca..0e37aeacf5 100644 --- a/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx +++ b/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx @@ -30,60 +30,57 @@ #include "otbImageFileWriter.h" #include "itkMeanImageFilter.h" - -int otbStreamingImageFileWriterWithFilterTest (int argc, char* argv[]) +int otbStreamingImageFileWriterWithFilterTest(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; unsigned int radius = atoi(argv[3]); - int iStreaming(::atoi(argv[4])); - bool streaming = (bool)(iStreaming); - int NumberOfStreamDivisions(10); - if ( streaming == true ) - { + int iStreaming(::atoi(argv[4])); + bool streaming = (bool) (iStreaming); + int NumberOfStreamDivisions(10); + if (streaming == true) + { NumberOfStreamDivisions = ::atoi(argv[5]); - } - + } - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::MeanImageFilter<InputImageType,OutputImageType> FilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> StreamingWriterType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef itk::MeanImageFilter<InputImageType, OutputImageType> FilterType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); InputImageType::SizeType rad; rad.Fill(radius); filter->SetRadius(rad); - if ( streaming == true ) - { - std::cout << "Streaming writing test"<<std::endl; + if (streaming == true) + { + std::cout << "Streaming writing test" << std::endl; StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); - writer->SetInput( filter->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetNumberOfStreamDivisions(NumberOfStreamDivisions); + writer->SetInput(filter->GetOutput()); writer->Update(); - } + } else - { - std::cout << "Writing test"<<std::endl; + { + std::cout << "Writing test" << std::endl; WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetInput(reader->GetOutput()); writer->Update(); - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingImageFilterTest.cxx b/Testing/Code/IO/otbStreamingImageFilterTest.cxx index 6db1a34ac5..d011b5fb81 100644 --- a/Testing/Code/IO/otbStreamingImageFilterTest.cxx +++ b/Testing/Code/IO/otbStreamingImageFilterTest.cxx @@ -29,40 +29,38 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbStreamingImageFilterTest (int argc, char* argv[]) +int otbStreamingImageFilterTest(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image<InputPixelType, Dimension> InputImageType; + typedef itk::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - - typedef itk::StreamingImageFilter<InputImageType,OutputImageType> StreamingImageFilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef itk::StreamingImageFilter<InputImageType, OutputImageType> StreamingImageFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); StreamingImageFilterType::Pointer streamer = StreamingImageFilterType::New(); - streamer->SetInput( reader->GetOutput() ); - streamer->SetNumberOfStreamDivisions( 10 ); + streamer->SetInput(reader->GetOutput()); + streamer->SetNumberOfStreamDivisions(10); streamer->Update(); - writer->SetInput( streamer->GetOutput() ); + writer->SetInput(streamer->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx b/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx index 34cd4ad429..7ece361b39 100644 --- a/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx +++ b/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx @@ -29,52 +29,50 @@ #include "otbStreamingImageFileWriter.h" #include "otbImageFileWriter.h" -int otbStreamingShortImageFileWriterTest (int argc, char* argv[]) +int otbStreamingShortImageFileWriterTest(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - int iStreaming(::atoi(argv[3])); - bool streaming = (bool)(iStreaming); - int NumberOfStreamDivisions(10); - if ( streaming == true ) - { + int iStreaming(::atoi(argv[3])); + bool streaming = (bool) (iStreaming); + int NumberOfStreamDivisions(10); + if (streaming == true) + { NumberOfStreamDivisions = ::atoi(argv[4]); - } + } + typedef unsigned short InputPixelType; + typedef unsigned short OutputPixelType; + const unsigned int Dimension = 2; - typedef unsigned short InputPixelType; - typedef unsigned short OutputPixelType; - const unsigned int Dimension = 2; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> StreamingWriterType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); - if ( streaming == true ) - { - std::cout << "Streaming writing test"<<std::endl; + if (streaming == true) + { + std::cout << "Streaming writing test" << std::endl; StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); - writer->SetInput( reader->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetNumberOfStreamDivisions(NumberOfStreamDivisions); + writer->SetInput(reader->GetOutput()); writer->Update(); - } + } else - { - std::cout << "Writing test"<<std::endl; + { + std::cout << "Writing test" << std::endl; WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetInput(reader->GetOutput()); writer->Update(); - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingWithImageFileWriterTestCalculateNumberOfDivisions.cxx b/Testing/Code/IO/otbStreamingWithImageFileWriterTestCalculateNumberOfDivisions.cxx index 3522c2e41e..922f9b4624 100644 --- a/Testing/Code/IO/otbStreamingWithImageFileWriterTestCalculateNumberOfDivisions.cxx +++ b/Testing/Code/IO/otbStreamingWithImageFileWriterTestCalculateNumberOfDivisions.cxx @@ -25,67 +25,65 @@ #include "otbImage.h" - #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbStreamingWithImageFileWriterTestCalculateNumberOfDivisions (int argc, char* argv[]) +int otbStreamingWithImageFileWriterTestCalculateNumberOfDivisions(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - std::string MethodCalculateNumberOfStreamDivision(argv[3]); + std::string MethodCalculateNumberOfStreamDivision(argv[3]); - typedef unsigned int PixelType; - const unsigned int Dimension = 2; + typedef unsigned int PixelType; + const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::ImageFileWriter< ImageType> StreamingWriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> StreamingWriterType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); - std::cout << "Streaming writing test"<<std::endl; + std::cout << "Streaming writing test" << std::endl; StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetInput(reader->GetOutput()); - if ( MethodCalculateNumberOfStreamDivision == "AUTOMATIC_NUMBER_OF_STREAM_DIVISIONS" ) - { + if (MethodCalculateNumberOfStreamDivision == "AUTOMATIC_NUMBER_OF_STREAM_DIVISIONS") + { writer->SetAutomaticNumberOfStreamDivisions(); - } - else if ( MethodCalculateNumberOfStreamDivision == "NUMBER_OF_STREAM_DIVISIONS" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "NUMBER_OF_STREAM_DIVISIONS") + { writer->SetNumberOfStreamDivisions(::atoi(argv[4])); - } - else if ( MethodCalculateNumberOfStreamDivision == "BUFFER_MEMORY_SIZE" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "BUFFER_MEMORY_SIZE") + { writer->SetBufferMemorySize(::atoi(argv[4])); - } - else if ( MethodCalculateNumberOfStreamDivision == "BUFFER_NUMBER_OF_LINES" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "BUFFER_NUMBER_OF_LINES") + { writer->SetBufferNumberOfLinesDivisions(::atoi(argv[4])); - } - else if ( MethodCalculateNumberOfStreamDivision == "TILING_STREAM_DIVISIONS" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "TILING_STREAM_DIVISIONS") + { // writer->SetTilingStreamDivisions(); - } - else if ( MethodCalculateNumberOfStreamDivision == "TILING_NUMBER_OF_STREAM_DIVISIONS" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "TILING_NUMBER_OF_STREAM_DIVISIONS") + { // std::cout << "Number : " << ::atoi(argv[4]) << std::endl; // writer->SetTilingStreamDivisions(::atoi(argv[4])); - } - else if ( MethodCalculateNumberOfStreamDivision == "DEFAULT" ) - { + } + else if (MethodCalculateNumberOfStreamDivision == "DEFAULT") + { - } + } else - { - itkGenericExceptionMacro(<<"Parameter value not authorized !!!"); - } + { + itkGenericExceptionMacro(<< "Parameter value not authorized !!!"); + } writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbTerraSarImageMetadataInterface.cxx b/Testing/Code/IO/otbTerraSarImageMetadataInterface.cxx index 091101c178..ea60bcac99 100644 --- a/Testing/Code/IO/otbTerraSarImageMetadataInterface.cxx +++ b/Testing/Code/IO/otbTerraSarImageMetadataInterface.cxx @@ -28,80 +28,101 @@ #include "otbImageFileReader.h" #include "otbTerraSarImageMetadataInterface.h" -int otbTerraSarImageMetadataInterface (int argc, char* argv[]) +int otbTerraSarImageMetadataInterface(int argc, char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef otb::VectorImage< double, 2 > InputImageType; - typedef otb::ImageFileReader< InputImageType > ImageReaderType; + typedef otb::VectorImage<double, 2> InputImageType; + typedef otb::ImageFileReader<InputImageType> ImageReaderType; - typedef std::vector<double> DoubleVectorType; - typedef std::vector<DoubleVectorType> DoubleVectorVectorType; - typedef std::vector<unsigned int> UIntVectorType; + typedef std::vector<double> DoubleVectorType; + typedef std::vector<DoubleVectorType> DoubleVectorVectorType; + typedef std::vector<unsigned int> UIntVectorType; - typedef itk::ImageBase< 2 > ImageType; - typedef ImageType::IndexType IndexType; - typedef std::vector<IndexType> IndexVectorType; - + typedef itk::ImageBase<2> ImageType; + typedef ImageType::IndexType IndexType; + typedef std::vector<IndexType> IndexVectorType; ImageReaderType::Pointer reader = ImageReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->UpdateOutputInformation(); otb::TerraSarImageMetadataInterface::Pointer lImageMetadata = otb::TerraSarImageMetadataInterface::New(); std::ofstream file; file.open(outputFilename); - file<<"GetSensorID: "<<lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetMinute: "<<lImageMetadata->GetMinute(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetHour: "<<lImageMetadata->GetHour(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetDay: "<<lImageMetadata->GetDay(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetMonth: "<<lImageMetadata->GetMonth(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetYear: "<<lImageMetadata->GetYear(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetProductionDay: "<<lImageMetadata->GetProductionDay(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetProductionMonth: "<<lImageMetadata->GetProductionMonth(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetProductionYear: "<<lImageMetadata->GetProductionYear(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetCalibrationFactor: "<<lImageMetadata->GetCalibrationFactor(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetRadarFrequency: "<<lImageMetadata->GetRadarFrequency(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<"GetPRF: "<<lImageMetadata->GetPRF(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - file<<std::endl; - file<<"Noise attributs: "<<std::endl; + file << "GetSensorID: " << lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetMinute: " << lImageMetadata->GetMinute(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetHour: " << lImageMetadata->GetHour(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetDay: " << lImageMetadata->GetDay(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetMonth: " << lImageMetadata->GetMonth(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetYear: " << lImageMetadata->GetYear(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << "GetProductionDay: " << + lImageMetadata->GetProductionDay(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetProductionMonth: " << + lImageMetadata->GetProductionMonth(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetProductionYear: " << + lImageMetadata->GetProductionYear(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetCalibrationFactor: " << lImageMetadata->GetCalibrationFactor( + reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetRadarFrequency: " << + lImageMetadata->GetRadarFrequency(reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + file << "GetPRF: " << lImageMetadata->GetPRF(reader->GetOutput()->GetMetaDataDictionary()) << + std::endl; + file << std::endl; + file << "Noise attributs: " << std::endl; UIntVectorType deg = lImageMetadata->GetNoisePolynomialDegrees(reader->GetOutput()->GetMetaDataDictionary()); - DoubleVectorVectorType coeffs = lImageMetadata->GetNoisePolynomialCoefficientsList(reader->GetOutput()->GetMetaDataDictionary()); - DoubleVectorType mins = lImageMetadata->GetNoiseValidityRangeMinList(reader->GetOutput()->GetMetaDataDictionary()); - DoubleVectorType maxs = lImageMetadata->GetNoiseValidityRangeMaxList(reader->GetOutput()->GetMetaDataDictionary()); - DoubleVectorType ref = lImageMetadata->GetNoiseReferencePointList(reader->GetOutput()->GetMetaDataDictionary()); - DoubleVectorType time = lImageMetadata->GetNoiseTimeUTCList(reader->GetOutput()->GetMetaDataDictionary()); - file<<"GetNumberOfNoiseRecords: "<< lImageMetadata->GetNumberOfNoiseRecords(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - for( unsigned int i=0; i<deg.size(); i++ ) + DoubleVectorVectorType coeffs = lImageMetadata->GetNoisePolynomialCoefficientsList( + reader->GetOutput()->GetMetaDataDictionary()); + DoubleVectorType mins = lImageMetadata->GetNoiseValidityRangeMinList( + reader->GetOutput()->GetMetaDataDictionary()); + DoubleVectorType maxs = lImageMetadata->GetNoiseValidityRangeMaxList( + reader->GetOutput()->GetMetaDataDictionary()); + DoubleVectorType ref = lImageMetadata->GetNoiseReferencePointList(reader->GetOutput()->GetMetaDataDictionary()); + DoubleVectorType time = lImageMetadata->GetNoiseTimeUTCList(reader->GetOutput()->GetMetaDataDictionary()); + file << "GetNumberOfNoiseRecords: " << lImageMetadata->GetNumberOfNoiseRecords( + reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + for (unsigned int i = 0; i < deg.size(); i++) { - file<<"Noise Polynom "<<i<<" ( degree: "<<deg[i]<<")"<<std::endl; - file<<"coefficients: "; - for( unsigned int j=0; j<coeffs[i].size(); j++ ) - { - file<<coeffs[i][j]<<" "; - } - file<<std::endl; - file<<"Min validity range: "<<mins[i]<<std::endl; - file<<"Min validity range: "<<maxs[i]<<std::endl; - file<<"Reference point: "<<ref[i]<<std::endl; - file<<"Time UTC: "<<time[i]<<std::endl; + file << "Noise Polynom " << i << " ( degree: " << deg[i] << ")" << std::endl; + file << "coefficients: "; + for (unsigned int j = 0; j < coeffs[i].size(); j++) + { + file << coeffs[i][j] << " "; + } + file << std::endl; + file << "Min validity range: " << mins[i] << std::endl; + file << "Min validity range: " << maxs[i] << std::endl; + file << "Reference point: " << ref[i] << std::endl; + file << "Time UTC: " << time[i] << std::endl; } - file<<"Incidence Angles attributs: "<<std::endl; + file << "Incidence Angles attributs: " << std::endl; IndexType centerIndexType = lImageMetadata->GetCenterIncidenceAngleIndex(reader->GetOutput()->GetMetaDataDictionary()); - file<<"GetCenterIncidenceAngle: Value: "<<lImageMetadata->GetCenterIncidenceAngle(reader->GetOutput()->GetMetaDataDictionary()); - file<<" Index: Row: "<<centerIndexType[0]<<" Column: "<<centerIndexType[1]<<std::endl; - file<<"GetNumberOfCornerIncidenceAngles: "<<lImageMetadata->GetNumberOfCornerIncidenceAngles(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; - DoubleVectorType cornerIncidenceAngles = lImageMetadata->GetCornersIncidenceAngles(reader->GetOutput()->GetMetaDataDictionary()); - std::vector<IndexType> tabIndex = lImageMetadata->GetCornersIncidenceAnglesIndex(reader->GetOutput()->GetMetaDataDictionary()); - file<<"GetCornerIncidenceAngles: "<<std::endl; - for( unsigned int i=0; i<cornerIncidenceAngles.size(); i++) - { - file<<"Incidence Angle "<<i<<": Value: "<<cornerIncidenceAngles[i]<<" Index: Row: "<<tabIndex[i][0]<<" Column: "<<tabIndex[i][1]<<std::endl; - } - file<<"GetMeanIncidenceAngles: "<<lImageMetadata->GetMeanIncidenceAngles(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; + file << "GetCenterIncidenceAngle: Value: " << lImageMetadata->GetCenterIncidenceAngle( + reader->GetOutput()->GetMetaDataDictionary()); + file << " Index: Row: " << centerIndexType[0] << " Column: " << centerIndexType[1] << std::endl; + file << "GetNumberOfCornerIncidenceAngles: " << lImageMetadata->GetNumberOfCornerIncidenceAngles( + reader->GetOutput()->GetMetaDataDictionary()) << std::endl; + DoubleVectorType cornerIncidenceAngles = lImageMetadata->GetCornersIncidenceAngles( + reader->GetOutput()->GetMetaDataDictionary()); + std::vector<IndexType> tabIndex = lImageMetadata->GetCornersIncidenceAnglesIndex( + reader->GetOutput()->GetMetaDataDictionary()); + file << "GetCornerIncidenceAngles: " << std::endl; + for (unsigned int i = 0; i < cornerIncidenceAngles.size(); i++) + { + file << "Incidence Angle " << i << ": Value: " << cornerIncidenceAngles[i] << " Index: Row: " << tabIndex[i][0] << + " Column: " << tabIndex[i][1] << std::endl; + } + file << "GetMeanIncidenceAngles: " << lImageMetadata->GetMeanIncidenceAngles( + reader->GetOutput()->GetMetaDataDictionary()) << std::endl; file.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx b/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx index b49f7c25cb..56a40b5bba 100644 --- a/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx +++ b/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx @@ -28,9 +28,9 @@ #include "otbImageFileReader.h" #include "otbTerraSarImageMetadataInterface.h" -int otbTerraSarImageMetadataInterfaceNew (int argc, char* argv[]) +int otbTerraSarImageMetadataInterfaceNew(int argc, char* argv[]) { - + otb::TerraSarImageMetadataInterface::Pointer lImageMetadata = otb::TerraSarImageMetadataInterface::New(); return EXIT_SUCCESS; diff --git a/Testing/Code/IO/otbTileMapFetcherNew.cxx b/Testing/Code/IO/otbTileMapFetcherNew.cxx index dba1d5787a..5491e106ff 100644 --- a/Testing/Code/IO/otbTileMapFetcherNew.cxx +++ b/Testing/Code/IO/otbTileMapFetcherNew.cxx @@ -23,7 +23,7 @@ int otbTileMapFetcherNew(int argc, char * argv[]) { typedef otb::TileMapFetcher TileMapFetcherType; typedef TileMapFetcherType::Pointer TileMapFetcherPointerType; - + TileMapFetcherPointerType tmf = TileMapFetcherType::New(); return EXIT_SUCCESS; diff --git a/Testing/Code/IO/otbTileMapFetcherTest.cxx b/Testing/Code/IO/otbTileMapFetcherTest.cxx index 57bf27b3a4..272d1665db 100644 --- a/Testing/Code/IO/otbTileMapFetcherTest.cxx +++ b/Testing/Code/IO/otbTileMapFetcherTest.cxx @@ -24,64 +24,64 @@ int otbTileMapFetcherTest(int argc, char * argv[]) { - if(argc != 8) - { - std::cout<<"<x> <y> <z> <server name> <cache directory> <cache size> <output directory>"<<std::endl; + if (argc != 8) + { + std::cout << "<x> <y> <z> <server name> <cache directory> <cache size> <output directory>" << std::endl; return EXIT_FAILURE; - } + } else - { - typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::TileMapFetcher TileMapFetcherType; - typedef TileMapFetcherType::Pointer TileMapFetcherPointerType; - + { + typedef unsigned char PixelType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::TileMapFetcher TileMapFetcherType; + typedef TileMapFetcherType::Pointer TileMapFetcherPointerType; + unsigned int x = static_cast<unsigned int>(atoi(argv[1])); unsigned int y = static_cast<unsigned int>(atoi(argv[2])); unsigned int z = static_cast<unsigned int>(atoi(argv[3])); - std::string serverName = argv[4]; - std::string cacheDirectory = argv[5]; + std::string serverName = argv[4]; + std::string cacheDirectory = argv[5]; unsigned int cacheSize = static_cast<unsigned int>(atoi(argv[6])); - std::string directory = argv[7]; - + std::string directory = argv[7]; + std::ostringstream filename; std::ostringstream filename2; std::ostringstream filename3; - + TileMapFetcherPointerType tmf = TileMapFetcherType::New(); ImageType::Pointer img = ImageType::New(); WriterType::Pointer writer = WriterType::New(); - + tmf->SetServerName(serverName); tmf->SetCacheDirectory(cacheDirectory); tmf->SetCacheSize(cacheSize); - + /** Test fetching tile */ - img = tmf->FetchTile(x,y,z); - - filename<<directory; - filename<<"otTileMapFetcherTest_Toulouse.png"; - + img = tmf->FetchTile(x, y, z); + + filename << directory; + filename << "otTileMapFetcherTest_Toulouse.png"; + writer->SetFileName(filename.str()); writer->SetInput(img); writer->Update(); - + /** Test out of range */ - img = tmf->FetchTile(x,y,1); - - filename2<<directory; - filename2<<"otTileMapFetcherTest_OutOfRange.png"; - + img = tmf->FetchTile(x, y, 1); + + filename2 << directory; + filename2 << "otTileMapFetcherTest_OutOfRange.png"; + writer->SetFileName(filename2.str()); writer->SetInput(img); writer->Update(); - + /* Test Cache */ - for(unsigned int i=x; i<x+(5*cacheSize); i++) - { - img = tmf->FetchTile(i,y,z); + for (unsigned int i = x; i < x + (5 * cacheSize); i++) + { + img = tmf->FetchTile(i, y, z); + } } - } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbTileMapImageIOTest.cxx b/Testing/Code/IO/otbTileMapImageIOTest.cxx index 73518c435a..b6fc7944c4 100644 --- a/Testing/Code/IO/otbTileMapImageIOTest.cxx +++ b/Testing/Code/IO/otbTileMapImageIOTest.cxx @@ -28,72 +28,71 @@ #include "otbImageFileWriter.h" #include "ossim/projection/ossimTileMapModel.h" - -int otbTileMapImageIOTest( int argc, char* argv[] ) +int otbTileMapImageIOTest(int argc, char* argv[]) { - if (argc!=7) - { - std::cout << argv[0] <<" <inputFilename> <outputFilename> " + if (argc != 7) + { + std::cout << argv[0] << " <inputFilename> <outputFilename> " << "<cacheDirectory> <lon> <lat> <depth>" << std::endl; return EXIT_FAILURE; - } + } char * inputFilename = argv[1]; char * outputFilename = argv[2]; char * cacheDirectory = argv[3]; double lon = atof(argv[4]); double lat = atof(argv[5]); - int depth = atoi(argv[6]); - + int depth = atoi(argv[6]); + typedef itk::RGBPixel<unsigned char> RGBPixelType; typedef otb::Image<RGBPixelType, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::TileMapImageIO ImageIOType; ImageIOType::Pointer tileIO = ImageIOType::New(); - ReaderType::Pointer readerTile = ReaderType::New(); + ReaderType::Pointer readerTile = ReaderType::New(); tileIO->SetDepth(depth); tileIO->SetCacheDirectory(cacheDirectory); readerTile->SetImageIO(tileIO); readerTile->SetFileName(inputFilename); readerTile->UpdateOutputInformation(); - - typedef otb::InverseSensorModel<double> ModelType; - ModelType::Pointer model= ModelType::New(); + + typedef otb::InverseSensorModel<double> ModelType; + ModelType::Pointer model = ModelType::New(); model->SetImageGeometry(readerTile->GetOutput()->GetImageKeywordlist()); dynamic_cast<ossimTileMapModel*>(model->GetOssimModel())->setDepth(depth); if (!model) - { + { std::cerr << "Unable to create a model" << std::endl; return 1; - } + } typedef itk::Point <double, 2> PointType; PointType lonLatPoint; - lonLatPoint[0]=lon; - lonLatPoint[1]=lat; + lonLatPoint[0] = lon; + lonLatPoint[1] = lat; PointType tilePoint; - tilePoint=model->TransformPoint(lonLatPoint); + tilePoint = model->TransformPoint(lonLatPoint); - long int startX=static_cast<long int>(tilePoint[0]); - long int startY=static_cast<long int>(tilePoint[1]); + long int startX = static_cast<long int>(tilePoint[0]); + long int startY = static_cast<long int>(tilePoint[1]); long int sizeX = 500; long int sizeY = 500; - std::cerr << startX <<", "<< startY << std::endl; - std::cerr << sizeX <<", "<< sizeY << std::endl; + std::cerr << startX << ", " << startY << std::endl; + std::cerr << sizeX << ", " << sizeY << std::endl; - typedef otb::ExtractROI< RGBPixelType, RGBPixelType > ExtractROIFilterType; + typedef otb::ExtractROI<RGBPixelType, RGBPixelType> ExtractROIFilterType; ExtractROIFilterType::Pointer extractROIOsmFilter = ExtractROIFilterType::New(); - extractROIOsmFilter->SetStartX(startX-sizeX/2); - extractROIOsmFilter->SetStartY(startY-sizeY/2); - extractROIOsmFilter->SetSizeX( sizeX ); - extractROIOsmFilter->SetSizeY( sizeY ); + extractROIOsmFilter->SetStartX(startX - sizeX / 2); + extractROIOsmFilter->SetStartY(startY - sizeY / 2); + extractROIOsmFilter->SetSizeX(sizeX); + extractROIOsmFilter->SetSizeY(sizeY); extractROIOsmFilter->SetInput(readerTile->GetOutput()); @@ -102,6 +101,6 @@ int otbTileMapImageIOTest( int argc, char* argv[] ) writer->SetFileName(outputFilename); writer->SetInput(extractROIOsmFilter->GetOutput()); writer->Update(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbTileMapImageSource.cxx b/Testing/Code/IO/otbTileMapImageSource.cxx index 364ae1160f..83be5a408f 100644 --- a/Testing/Code/IO/otbTileMapImageSource.cxx +++ b/Testing/Code/IO/otbTileMapImageSource.cxx @@ -22,44 +22,44 @@ int otbTileMapImageSource(int argc, char * argv[]) { - if(argc != 6) - { - std::cout<<"<latitude> <longitude> <server> <output filename> <output size>"<<std::endl; + if (argc != 6) + { + std::cout << "<latitude> <longitude> <server> <output filename> <output size>" << std::endl; return EXIT_FAILURE; - } + } else - { + { const unsigned int Dimension = 2; - - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef ImageType::SizeType SizeType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::TileMapImageSource<ImageType> TileMapImageSourceType; - - double latitude = static_cast<double>(atof(argv[1])); - double longitude = static_cast<double>(atof(argv[2])); - char * serverName = argv[3]; - char * outputFilename = argv[4]; + + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef ImageType::SizeType SizeType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::TileMapImageSource<ImageType> TileMapImageSourceType; + + double latitude = static_cast<double>(atof(argv[1])); + double longitude = static_cast<double>(atof(argv[2])); + char * serverName = argv[3]; + char * outputFilename = argv[4]; const unsigned int outputSize = atoi(argv[5]); - SizeType size; + SizeType size; size[0] = outputSize; size[1] = outputSize; - + // Instantiating object TileMapImageSourceType::Pointer tileMap = TileMapImageSourceType::New(); tileMap->SetServerName(serverName); tileMap->SetLatitude(latitude); tileMap->SetLongitude(longitude); tileMap->SetSize(size); - + tileMap->UpdateOutputInformation(); - + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFilename); - + writer->SetInput(tileMap->GetOutput()); writer->Update(); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbTileMapImageSourceNew.cxx b/Testing/Code/IO/otbTileMapImageSourceNew.cxx index 7dd6236a61..ae71864a96 100644 --- a/Testing/Code/IO/otbTileMapImageSourceNew.cxx +++ b/Testing/Code/IO/otbTileMapImageSourceNew.cxx @@ -22,8 +22,8 @@ int otbTileMapImageSourceNew(int argc, char * argv[]) { - typedef otb::Image<double, 2> ImageType; - typedef otb::TileMapImageSource<ImageType> TileMapImageSourceType; + typedef otb::Image<double, 2> ImageType; + typedef otb::TileMapImageSource<ImageType> TileMapImageSourceType; // Instantiating object TileMapImageSourceType::Pointer object = TileMapImageSourceType::New(); diff --git a/Testing/Code/IO/otbTileMapWriter.cxx b/Testing/Code/IO/otbTileMapWriter.cxx index b20a593438..9ed7a828bc 100644 --- a/Testing/Code/IO/otbTileMapWriter.cxx +++ b/Testing/Code/IO/otbTileMapWriter.cxx @@ -31,55 +31,53 @@ #include "otbPerBandVectorImageFilter.h" #include "otbPrintableImageFilter.h" - int otbTileMapWriter(int argc, char *argv[]) { if (argc != 4) - { + { std::cerr << "Usage: " << argv[0] << "<image> <SRTM directory> <output directory>" << std::endl; return EXIT_FAILURE; - } - - int depth=14; - - typedef otb::Image<unsigned int, 2> ImageType; - typedef otb::Image<unsigned char, 2> CharImageType; - typedef otb::Image<double, 2> DoubleImageType; - - typedef otb::VectorImage<unsigned int, 2> VectorImageType; - typedef otb::VectorImage<unsigned char, 2> CharVectorImageType; - typedef otb::VectorImage<double, 2> DoubleVectorImageType; - + } + + int depth = 14; + + typedef otb::Image<unsigned int, 2> ImageType; + typedef otb::Image<unsigned char, 2> CharImageType; + typedef otb::Image<double, 2> DoubleImageType; + + typedef otb::VectorImage<unsigned int, 2> VectorImageType; + typedef otb::VectorImage<unsigned char, 2> CharVectorImageType; + typedef otb::VectorImage<double, 2> DoubleVectorImageType; + typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType, 2> RGBImageType; + typedef otb::Image<RGBPixelType, 2> RGBImageType; - typedef otb::ImageFileReader<VectorImageType> VectorReaderType; - VectorReaderType::Pointer readerXS=VectorReaderType::New(); + typedef otb::ImageFileReader<VectorImageType> VectorReaderType; + VectorReaderType::Pointer readerXS = VectorReaderType::New(); readerXS->SetFileName(argv[1]); - + typedef otb::TileMapTransform<otb::INVERSE> MapProjectionType; typedef otb::OrthoRectificationFilter - <ImageType, DoubleImageType,MapProjectionType> OrthoRectifFilterType; - typedef otb::ImageFileWriter<CharVectorImageType> WriterType; - - + <ImageType, DoubleImageType, MapProjectionType> OrthoRectifFilterType; + typedef otb::ImageFileWriter<CharVectorImageType> WriterType; + MapProjectionType::Pointer mapProjection = MapProjectionType::New(); mapProjection->SetLevel(depth); - + ImageType::IndexType start; - start[0]=0; - start[1]=0; - + start[0] = 0; + start[1] = 0; + ImageType::SizeType size; - size[0]=2000; - size[1]=2000; - + size[0] = 2000; + size[1] = 2000; + ImageType::SpacingType spacing; - spacing[0]=1; - spacing[1]=1; - + spacing[0] = 1; + spacing[1] = 1; + typedef itk::Point <double, 2> PointType; PointType lonLatUL; // lonLatUL[0] = 103.843; //Sentosa @@ -91,10 +89,10 @@ int otbTileMapWriter(int argc, char *argv[]) // lonLatUL[1] = 43.5596826111; //Tests Toulouse // lonLatUL[0] = 1.4835345; // lonLatUL[0] = -68.1; //Tests LaPaz -// lonLatUL[1] = -16.5; +// lonLatUL[1] = -16.5; lonLatUL[0] = 51.15; //Tests Iran spot5 lonLatUL[1] = 35.9; - + typedef otb::TileMapTransform<otb::FORWARD> MapProjectionForwardType; MapProjectionForwardType::Pointer mapProjectionForward = MapProjectionForwardType::New(); mapProjectionForward->SetLevel(depth); @@ -102,19 +100,19 @@ int otbTileMapWriter(int argc, char *argv[]) pointULexact = mapProjectionForward->TransformPoint(lonLatUL); PointType pointLRexact; - pointLRexact[0]=pointULexact[0]+size[0]*spacing[0]; - pointLRexact[1]=pointULexact[1]+size[1]*spacing[1]; - + pointLRexact[0] = pointULexact[0] + size[0] * spacing[0]; + pointLRexact[1] = pointULexact[1] + size[1] * spacing[1]; + PointType lonLatLR; lonLatLR = mapProjection->TransformPoint(pointLRexact); typedef otb::PerBandVectorImageFilter<VectorImageType, - DoubleVectorImageType, OrthoRectifFilterType> VectorOrthoRectifFilterType; + DoubleVectorImageType, OrthoRectifFilterType> VectorOrthoRectifFilterType; - OrthoRectifFilterType::Pointer orthoRectifXS = - OrthoRectifFilterType::New(); - VectorOrthoRectifFilterType::Pointer orthoRectifXSVector = - VectorOrthoRectifFilterType::New(); + OrthoRectifFilterType::Pointer orthoRectifXS = + OrthoRectifFilterType::New(); + VectorOrthoRectifFilterType::Pointer orthoRectifXSVector = + VectorOrthoRectifFilterType::New(); orthoRectifXSVector->SetFilter(orthoRectifXS); orthoRectifXS->SetMapProjection(mapProjection); @@ -134,23 +132,22 @@ int otbTileMapWriter(int argc, char *argv[]) printable->SetChannel(2); printable->SetChannel(3); - typedef otb::ImageRegionTileMapSplitter<2> SplitterType; SplitterType::Pointer splitter = SplitterType::New(); - + typedef otb::TileMapImageIO ImageIOType; ImageIOType::Pointer tileMapIO = ImageIOType::New(); tileMapIO->SetDepth(depth); tileMapIO->SetCacheDirectory(argv[3]); tileMapIO->SetFileSuffix("jpg"); - - WriterType::Pointer writer=WriterType::New(); + + WriterType::Pointer writer = WriterType::New(); writer->SetFileName("test.otb"); writer->SetImageIO(tileMapIO); writer->SetNumberOfThreads(1); writer->SetInput(printable->GetOutput()); - writer->Update(); - + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbVectorDataFileGeoReaderWriter.cxx b/Testing/Code/IO/otbVectorDataFileGeoReaderWriter.cxx index bc9e26450a..33eab819f3 100644 --- a/Testing/Code/IO/otbVectorDataFileGeoReaderWriter.cxx +++ b/Testing/Code/IO/otbVectorDataFileGeoReaderWriter.cxx @@ -27,15 +27,14 @@ int otbVectorDataFileGeoReaderWriter(int argc, char * argv[]) { - typedef otb::VectorData<double,2> VectorDataType; + typedef otb::VectorData<double, 2> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataReaderType; typedef otb::VectorDataFileWriter<VectorDataType> VectorDataWriterType; - //Instantiation VectorDataReaderType::Pointer vectorDataReader = VectorDataReaderType::New(); VectorDataWriterType::Pointer vectorDataWriter = VectorDataWriterType::New(); - VectorDataType::Pointer data = VectorDataType::New(); + VectorDataType::Pointer data = VectorDataType::New(); vectorDataReader->SetFileName(argv[1]); @@ -43,11 +42,11 @@ int otbVectorDataFileGeoReaderWriter(int argc, char * argv[]) // vectorData->SetSpacing(m_Reader->GetOutput()->GetSpacing()); std::string projectionRef; - itk::ExposeMetaData<std::string>(vectorDataReader->GetOutput()->GetMetaDataDictionary(), otb::MetaDataKey::ProjectionRefKey, projectionRef ); + itk::ExposeMetaData<std::string>( + vectorDataReader->GetOutput()->GetMetaDataDictionary(), otb::MetaDataKey::ProjectionRefKey, projectionRef); // vectorData->SetProjectionRef(projectionRef); std::cout << projectionRef << std::endl; - vectorDataWriter->SetFileName(argv[2]); vectorDataWriter->SetInput(vectorDataReader->GetOutput()); vectorDataWriter->Update(); diff --git a/Testing/Code/IO/otbVectorDataFileReader.cxx b/Testing/Code/IO/otbVectorDataFileReader.cxx index 203ffb333a..cbabe1d114 100644 --- a/Testing/Code/IO/otbVectorDataFileReader.cxx +++ b/Testing/Code/IO/otbVectorDataFileReader.cxx @@ -26,12 +26,12 @@ int otbVectorDataFileReader(int argc, char * argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); - typedef otb::DataNode<double,2,double> DataNodeType; - typedef DataNodeType::Pointer DataNodePointerType; + typedef otb::DataNode<double, 2, double> DataNodeType; + typedef DataNodeType::Pointer DataNodePointerType; typedef itk::TreeContainer<DataNodePointerType> DataTreeType; typedef itk::DataObject dataobjectType; @@ -41,7 +41,7 @@ int otbVectorDataFileReader(int argc, char * argv[]) reader->Update(); VectorDataType::Pointer data = reader->GetOutput(); - DataTreeType::Pointer dataTree = DataTreeType::New(); + DataTreeType::Pointer dataTree = DataTreeType::New(); dataTree = data->GetDataTree(); std::ofstream fout (argv[2]); @@ -50,17 +50,17 @@ int otbVectorDataFileReader(int argc, char * argv[]) it.GoToBegin(); while (!it.IsAtEnd()) - { - itk::PreOrderTreeIterator<DataTreeType> itParent = it; - bool goesOn = true; - while (itParent.HasParent() && goesOn ) { - fout<<indent; + itk::PreOrderTreeIterator<DataTreeType> itParent = it; + bool goesOn = true; + while (itParent.HasParent() && goesOn) + { + fout << indent; goesOn = itParent.GoToParent(); - } - fout<<"+"<<it.Get()->GetNodeTypeAsString()<<std::endl; + } + fout << "+" << it.Get()->GetNodeTypeAsString() << std::endl; ++it; - } + } /*added PrintSelf*/ fout.close(); diff --git a/Testing/Code/IO/otbVectorDataFileReaderNew.cxx b/Testing/Code/IO/otbVectorDataFileReaderNew.cxx index 6612783140..5c319eec40 100644 --- a/Testing/Code/IO/otbVectorDataFileReaderNew.cxx +++ b/Testing/Code/IO/otbVectorDataFileReaderNew.cxx @@ -21,10 +21,9 @@ int otbVectorDataFileReaderNew(int argc, char * argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer object = VectorDataFileReaderType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbVectorDataFileReaderWriter.cxx b/Testing/Code/IO/otbVectorDataFileReaderWriter.cxx index 7186cf101f..f7b55300bd 100644 --- a/Testing/Code/IO/otbVectorDataFileReaderWriter.cxx +++ b/Testing/Code/IO/otbVectorDataFileReaderWriter.cxx @@ -25,14 +25,13 @@ int otbVectorDataFileReaderWriter(int argc, char * argv[]) { - typedef otb::VectorData<double,2> VectorDataType; + typedef otb::VectorData<double, 2> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> ReaderType; typedef otb::VectorDataFileWriter<VectorDataType> WriterType; - //Instantiation - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); VectorDataType::Pointer data = VectorDataType::New(); reader->SetFileName(argv[1]); diff --git a/Testing/Code/IO/otbVectorDataFileWriter.cxx b/Testing/Code/IO/otbVectorDataFileWriter.cxx index 0719d6dad2..075d429c0f 100644 --- a/Testing/Code/IO/otbVectorDataFileWriter.cxx +++ b/Testing/Code/IO/otbVectorDataFileWriter.cxx @@ -24,16 +24,16 @@ int otbVectorDataFileWriter(int argc, char * argv[]) { - typedef otb::VectorData<double,2> VectorDataType; - typedef VectorDataType::DataNodeType DataNodeType; + typedef otb::VectorData<double, 2> VectorDataType; + typedef VectorDataType::DataNodeType DataNodeType; typedef otb::VectorDataFileWriter<VectorDataType> WriterType; - typedef DataNodeType::PointType PointType; - typedef DataNodeType::LineType LineType; - typedef DataNodeType::PolygonType PolygonType; - typedef LineType::VertexType VertexType; + typedef DataNodeType::PointType PointType; + typedef DataNodeType::LineType LineType; + typedef DataNodeType::PolygonType PolygonType; + typedef LineType::VertexType VertexType; //Instantiation - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); VectorDataType::Pointer data = VectorDataType::New(); DataNodeType::Pointer document = DataNodeType::New(); @@ -42,7 +42,6 @@ int otbVectorDataFileWriter(int argc, char * argv[]) DataNodeType::Pointer folder3 = DataNodeType::New(); DataNodeType::Pointer line = DataNodeType::New(); - document->SetNodeType(otb::DOCUMENT); folder1->SetNodeType(otb::FOLDER); folder2->SetNodeType(otb::FOLDER); @@ -62,9 +61,8 @@ int otbVectorDataFileWriter(int argc, char * argv[]) p3.Fill(0); VertexType p2; - p2[0]=0; - p2[1]=10; - + p2[0] = 0; + p2[1] = 10; LineType::Pointer l = LineType::New(); l->AddVertex(p1); @@ -72,14 +70,13 @@ int otbVectorDataFileWriter(int argc, char * argv[]) l->AddVertex(p3); line->SetLine(l); - DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get(); - data->GetDataTree()->Add(document,root); - data->GetDataTree()->Add(folder1,document); - data->GetDataTree()->Add(folder2,document); - data->GetDataTree()->Add(folder3,document); - data->GetDataTree()->Add(line,folder2); + data->GetDataTree()->Add(document, root); + data->GetDataTree()->Add(folder1, document); + data->GetDataTree()->Add(folder2, document); + data->GetDataTree()->Add(folder3, document); + data->GetDataTree()->Add(line, folder2); writer->SetFileName(argv[1]); writer->SetInput(data); diff --git a/Testing/Code/IO/otbVectorDataFileWriterNew.cxx b/Testing/Code/IO/otbVectorDataFileWriterNew.cxx index 568583ce1b..f29e8cc07d 100644 --- a/Testing/Code/IO/otbVectorDataFileWriterNew.cxx +++ b/Testing/Code/IO/otbVectorDataFileWriterNew.cxx @@ -21,8 +21,8 @@ int otbVectorDataFileWriterNew(int argc, char * argv[]) { - typedef otb::VectorData<double,2> VectorDataType; - typedef VectorDataType::DataNodeType DataNodeType; + typedef otb::VectorData<double, 2> VectorDataType; + typedef VectorDataType::DataNodeType DataNodeType; typedef otb::VectorDataFileWriter<VectorDataType> WriterType; //Instantiation diff --git a/Testing/Code/IO/otbVectorDataFileWriterPolygons.cxx b/Testing/Code/IO/otbVectorDataFileWriterPolygons.cxx index 9f0899ac48..f811e9cd38 100644 --- a/Testing/Code/IO/otbVectorDataFileWriterPolygons.cxx +++ b/Testing/Code/IO/otbVectorDataFileWriterPolygons.cxx @@ -24,16 +24,16 @@ int otbVectorDataFileWriterPolygons(int argc, char * argv[]) { - typedef otb::VectorData<double,2> VectorDataType; - typedef VectorDataType::DataNodeType DataNodeType; + typedef otb::VectorData<double, 2> VectorDataType; + typedef VectorDataType::DataNodeType DataNodeType; typedef otb::VectorDataFileWriter<VectorDataType> WriterType; - typedef DataNodeType::PointType PointType; - typedef DataNodeType::LineType LineType; - typedef DataNodeType::PolygonType PolygonType; - typedef LineType::VertexType VertexType; + typedef DataNodeType::PointType PointType; + typedef DataNodeType::LineType LineType; + typedef DataNodeType::PolygonType PolygonType; + typedef LineType::VertexType VertexType; //Instantiation - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); VectorDataType::Pointer data = VectorDataType::New(); DataNodeType::Pointer document = DataNodeType::New(); @@ -60,9 +60,8 @@ int otbVectorDataFileWriterPolygons(int argc, char * argv[]) p3.Fill(0); VertexType p2; - p2[0]=0; - p2[1]=10; - + p2[0] = 0; + p2[1] = 10; PolygonType::Pointer poly = PolygonType::New(); poly->AddVertex(p1); @@ -70,20 +69,20 @@ int otbVectorDataFileWriterPolygons(int argc, char * argv[]) poly->AddVertex(p3); polygon1->SetLine(poly); - polygon2=polygon1; - polygon3=polygon1; - polygon4=polygon1; - polygon5=polygon1; + polygon2 = polygon1; + polygon3 = polygon1; + polygon4 = polygon1; + polygon5 = polygon1; DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get(); - data->GetDataTree()->Add(document,root); - data->GetDataTree()->Add(folder,document); - data->GetDataTree()->Add(polygon1,folder); - data->GetDataTree()->Add(polygon2,folder); - data->GetDataTree()->Add(polygon3,folder); - data->GetDataTree()->Add(polygon4,folder); - data->GetDataTree()->Add(polygon5,folder); + data->GetDataTree()->Add(document, root); + data->GetDataTree()->Add(folder, document); + data->GetDataTree()->Add(polygon1, folder); + data->GetDataTree()->Add(polygon2, folder); + data->GetDataTree()->Add(polygon3, folder); + data->GetDataTree()->Add(polygon4, folder); + data->GetDataTree()->Add(polygon5, folder); writer->SetFileName(argv[1]); writer->SetInput(data); diff --git a/Testing/Code/IO/otbVectorDataKeywordlist.cxx b/Testing/Code/IO/otbVectorDataKeywordlist.cxx index 4fe45fc11b..664a3fa40c 100644 --- a/Testing/Code/IO/otbVectorDataKeywordlist.cxx +++ b/Testing/Code/IO/otbVectorDataKeywordlist.cxx @@ -26,12 +26,12 @@ int otbVectorDataKeywordlist(int argc, char * argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); - typedef otb::DataNode<double,2,double> DataNodeType; - typedef DataNodeType::Pointer DataNodePointerType; + typedef otb::DataNode<double, 2, double> DataNodeType; + typedef DataNodeType::Pointer DataNodePointerType; typedef itk::TreeContainer<DataNodePointerType> DataTreeType; typedef itk::DataObject dataobjectType; @@ -41,7 +41,7 @@ int otbVectorDataKeywordlist(int argc, char * argv[]) reader->Update(); VectorDataType::Pointer data = reader->GetOutput(); - DataTreeType::Pointer dataTree = DataTreeType::New(); + DataTreeType::Pointer dataTree = DataTreeType::New(); dataTree = data->GetDataTree(); std::ofstream fout (argv[2]); @@ -50,31 +50,31 @@ int otbVectorDataKeywordlist(int argc, char * argv[]) it.GoToBegin(); while (!it.IsAtEnd()) - { - itk::PreOrderTreeIterator<DataTreeType> itParent = it; - bool goesOn = true; - while (itParent.HasParent() && goesOn ) { - fout<<indent; + itk::PreOrderTreeIterator<DataTreeType> itParent = it; + bool goesOn = true; + while (itParent.HasParent() && goesOn) + { + fout << indent; goesOn = itParent.GoToParent(); - } - if(it.Get()->GetMetaDataDictionary().HasKey(otb::MetaDataKey::VectorDataKeywordlistKey)) - { + } + if (it.Get()->GetMetaDataDictionary().HasKey(otb::MetaDataKey::VectorDataKeywordlistKey)) + { otb::VectorDataKeywordlist kwl; itk::ExposeMetaData<otb::VectorDataKeywordlist>(it.Get()->GetMetaDataDictionary(), - otb::MetaDataKey::VectorDataKeywordlistKey, - kwl); + otb::MetaDataKey::VectorDataKeywordlistKey, + kwl); fout << "New node: " << kwl.GetNumberOfFields() << " fields" << std::endl; fout << "- HasField(\"name\"): " << kwl.HasField("name") << std::endl; if (kwl.HasField("name")) - { + { fout << "- name: " << kwl.GetFieldAsString("name") << std::endl; - } + } fout << std::endl; - } + } ++it; - } + } /*added PrintSelf*/ fout.close(); diff --git a/Testing/Code/IO/otbVectorDataSourceNew.cxx b/Testing/Code/IO/otbVectorDataSourceNew.cxx index a2dee83bd9..228e3ecec7 100644 --- a/Testing/Code/IO/otbVectorDataSourceNew.cxx +++ b/Testing/Code/IO/otbVectorDataSourceNew.cxx @@ -21,7 +21,7 @@ int otbVectorDataSourceNew(int argc, char * argv[]) { - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataSource<VectorDataType> VectorDataSourceType; VectorDataSourceType::Pointer object = VectorDataSourceType::New(); diff --git a/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx b/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx index a117b05f01..9cdd75f368 100644 --- a/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx +++ b/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbVectorImage.h" #include "itkExceptionObject.h" #include <iostream> @@ -35,25 +34,24 @@ int otbVectorImageFileReaderWriterTest(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - writer->SetInput( reader->GetOutput() ); + writer->SetInput(reader->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbVectorImageTest.cxx b/Testing/Code/IO/otbVectorImageTest.cxx index 5ba0499d24..8604724dd6 100644 --- a/Testing/Code/IO/otbVectorImageTest.cxx +++ b/Testing/Code/IO/otbVectorImageTest.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include <iostream> #include <fstream> @@ -29,7 +28,6 @@ #include "otbVectorImage.h" #include "otbImageFileReader.h" - int otbVectorImageTest(int argc, char* argv[]) { // Verify the number of parameters in the command line @@ -37,23 +35,22 @@ int otbVectorImageTest(int argc, char* argv[]) const char * outputAsciiFilename = argv[2]; // unsigned int GCPnum((unsigned int)::atoi(argv[2])); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; std::ofstream file; file.open(outputAsciiFilename); - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; InputImageType::Pointer image = InputImageType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; - + typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); + reader->SetFileName(inputFilename); reader->UpdateOutputInformation(); image = reader->GetOutput(); @@ -75,8 +72,8 @@ int otbVectorImageTest(int argc, char* argv[]) unsigned int GCPCount = image->GetGCPCount(); file << "GCP Count " << image->GetGCPCount() << std::endl; - for (unsigned int GCPnum = 0; GCPnum < GCPCount; GCPnum++ ) - { + for (unsigned int GCPnum = 0; GCPnum < GCPCount; GCPnum++) + { file << "GCP[" << GCPnum << "] Id " << image->GetGCPId(GCPnum) << std::endl; file << "GCP[" << GCPnum << "] Info " << image->GetGCPInfo(GCPnum) << std::endl; file << "GCP[" << GCPnum << "] Row " << image->GetGCPRow(GCPnum) << std::endl; @@ -85,49 +82,47 @@ int otbVectorImageTest(int argc, char* argv[]) file << "GCP[" << GCPnum << "] Y " << image->GetGCPY(GCPnum) << std::endl; file << "GCP[" << GCPnum << "] Z " << image->GetGCPZ(GCPnum) << std::endl; file << "----------------" << std::endl; - } + } InputImageType::VectorType tab = image->GetGeoTransform(); file << "Geo Transform " << std::endl; - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " " <<i<<" -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " " << i << " -> " << tab[i] << std::endl; + } tab.clear(); tab = image->GetUpperLeftCorner(); file << "Corners " << std::endl; - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " UL[" <<i<<"] -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " UL[" << i << "] -> " << tab[i] << std::endl; + } tab.clear(); tab = image->GetUpperRightCorner(); - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " UR[" <<i<<"] -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " UR[" << i << "] -> " << tab[i] << std::endl; + } tab.clear(); tab = image->GetLowerLeftCorner(); - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " LL[" <<i<<"] -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " LL[" << i << "] -> " << tab[i] << std::endl; + } tab.clear(); tab = image->GetLowerRightCorner(); - for (unsigned int i = 0; i < tab.size(); i++ ) - { - file << " LR[" <<i<<"] -> "<<tab[i]<< std::endl; - } + for (unsigned int i = 0; i < tab.size(); i++) + { + file << " LR[" << i << "] -> " << tab[i] << std::endl; + } tab.clear(); file.close(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/IO/otbWritingComplexDataWithComplexImageTest.cxx b/Testing/Code/IO/otbWritingComplexDataWithComplexImageTest.cxx index e9ec508501..999523041f 100644 --- a/Testing/Code/IO/otbWritingComplexDataWithComplexImageTest.cxx +++ b/Testing/Code/IO/otbWritingComplexDataWithComplexImageTest.cxx @@ -23,19 +23,19 @@ #include "otbImage.h" #include "otbMacro.h" -int otbWritingComplexDataWithComplexImageTest(int argc,char * argv[]) +int otbWritingComplexDataWithComplexImageTest(int argc, char * argv[]) { - typedef double RealType; - typedef std::complex<RealType> PixelType; - typedef otb::Image<PixelType,2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::ExtractROI<PixelType,PixelType> ExtractROIFilterType; + typedef double RealType; + typedef std::complex<RealType> PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::ExtractROI<PixelType, PixelType> ExtractROIFilterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); - ExtractROIFilterType::Pointer extract =ExtractROIFilterType::New(); + ExtractROIFilterType::Pointer extract = ExtractROIFilterType::New(); extract->SetInput(reader->GetOutput()); extract->SetStartX(atoi(argv[3])); extract->SetStartY(atoi(argv[4])); diff --git a/Testing/Code/Learning/otbExhaustiveExponentialOptimizerNew.cxx b/Testing/Code/Learning/otbExhaustiveExponentialOptimizerNew.cxx index c265be314b..a8e1638d7a 100644 --- a/Testing/Code/Learning/otbExhaustiveExponentialOptimizerNew.cxx +++ b/Testing/Code/Learning/otbExhaustiveExponentialOptimizerNew.cxx @@ -20,16 +20,13 @@ #pragma warning ( disable : 4786 ) #endif - #include <iostream> #include "otbExhaustiveExponentialOptimizer.h" -int otbExhaustiveExponentialOptimizerNew( int argc, char* argv[] ) +int otbExhaustiveExponentialOptimizerNew(int argc, char* argv[]) { otb::ExhaustiveExponentialOptimizer::Pointer opt = otb::ExhaustiveExponentialOptimizer::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbKMeansImageClassificationFilter.cxx b/Testing/Code/Learning/otbKMeansImageClassificationFilter.cxx index 0de49fa4ca..797d43851b 100644 --- a/Testing/Code/Learning/otbKMeansImageClassificationFilter.cxx +++ b/Testing/Code/Learning/otbKMeansImageClassificationFilter.cxx @@ -23,21 +23,20 @@ int otbKMeansImageClassificationFilter(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * outfname = argv[2]; + const char * infname = argv[1]; + const char * outfname = argv[2]; const unsigned int nbClasses = atoi(argv[3]); - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; typedef double PixelType; typedef unsigned short LabeledPixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType; - typedef otb::KMeansImageClassificationFilter<ImageType,LabeledImageType> ClassificationFilterType; - typedef ClassificationFilterType::KMeansParametersType KMeansParametersType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType; - + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::Image<LabeledPixelType, Dimension> LabeledImageType; + typedef otb::KMeansImageClassificationFilter<ImageType, LabeledImageType> ClassificationFilterType; + typedef ClassificationFilterType::KMeansParametersType KMeansParametersType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType; // Instantiating object ClassificationFilterType::Pointer filter = ClassificationFilterType::New(); @@ -46,22 +45,22 @@ int otbKMeansImageClassificationFilter(int argc, char * argv[]) reader->SetFileName(infname); reader->GenerateOutputInformation(); - const unsigned int sampleSize = ClassificationFilterType::MaxSampleDimension; - const unsigned int parameterSize = nbClasses * sampleSize; + const unsigned int sampleSize = ClassificationFilterType::MaxSampleDimension; + const unsigned int parameterSize = nbClasses * sampleSize; KMeansParametersType parameters; parameters.SetSize(parameterSize); parameters.Fill(0); - for (unsigned int i = 0; i<nbClasses;++i) - { - for (unsigned int j = 0; j < reader->GetOutput()->GetNumberOfComponentsPerPixel();++j) + for (unsigned int i = 0; i < nbClasses; ++i) { - parameters[i*sampleSize+j]=atof(argv[4+i*reader->GetOutput()->GetNumberOfComponentsPerPixel()+j]); + for (unsigned int j = 0; j < reader->GetOutput()->GetNumberOfComponentsPerPixel(); ++j) + { + parameters[i * sampleSize + j] = atof(argv[4 + i * reader->GetOutput()->GetNumberOfComponentsPerPixel() + j]); + } } - } - std::cout<<"Parameters: "<<parameters<<std::endl; + std::cout << "Parameters: " << parameters << std::endl; filter->SetCentroids(parameters); filter->SetInput(reader->GetOutput()); diff --git a/Testing/Code/Learning/otbKMeansImageClassificationFilterNew.cxx b/Testing/Code/Learning/otbKMeansImageClassificationFilterNew.cxx index e3696ce388..904c7c5697 100644 --- a/Testing/Code/Learning/otbKMeansImageClassificationFilterNew.cxx +++ b/Testing/Code/Learning/otbKMeansImageClassificationFilterNew.cxx @@ -21,14 +21,14 @@ int otbKMeansImageClassificationFilterNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; typedef double PixelType; typedef unsigned short LabeledPixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::Image<LabeledPixelType, Dimension> LabeledImageType; - typedef otb::KMeansImageClassificationFilter<ImageType,LabeledImageType> ClassificationFilterType; + typedef otb::KMeansImageClassificationFilter<ImageType, LabeledImageType> ClassificationFilterType; // Instantiating object ClassificationFilterType::Pointer object = ClassificationFilterType::New(); diff --git a/Testing/Code/Learning/otbLearningTests1.cxx b/Testing/Code/Learning/otbLearningTests1.cxx index 8a36636ff9..cca51415aa 100644 --- a/Testing/Code/Learning/otbLearningTests1.cxx +++ b/Testing/Code/Learning/otbLearningTests1.cxx @@ -16,14 +16,12 @@ =========================================================================*/ - // this file defines the otbCommonTest for the test driver // and all it expects is that you have a function called RegisterTests #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/Learning/otbLearningTests2.cxx b/Testing/Code/Learning/otbLearningTests2.cxx index fb8fadf27f..d6c76168d2 100644 --- a/Testing/Code/Learning/otbLearningTests2.cxx +++ b/Testing/Code/Learning/otbLearningTests2.cxx @@ -16,14 +16,12 @@ =========================================================================*/ - // this file defines the otbCommonTest for the test driver // and all it expects is that you have a function called RegisterTests #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/Learning/otbLearningTests3.cxx b/Testing/Code/Learning/otbLearningTests3.cxx index 8bf852d9ab..18a23a33ce 100644 --- a/Testing/Code/Learning/otbLearningTests3.cxx +++ b/Testing/Code/Learning/otbLearningTests3.cxx @@ -16,14 +16,12 @@ =========================================================================*/ - // this file defines the otbCommonTest for the test driver // and all it expects is that you have a function called RegisterTests #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/Learning/otbLearningTests4.cxx b/Testing/Code/Learning/otbLearningTests4.cxx index 09c49169ca..1c116c3d5a 100644 --- a/Testing/Code/Learning/otbLearningTests4.cxx +++ b/Testing/Code/Learning/otbLearningTests4.cxx @@ -16,20 +16,18 @@ =========================================================================*/ - // this file defines the otbCommonTest for the test driver // and all it expects is that you have a function called RegisterTests #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbROIdataConversionNew); -REGISTER_TEST(otbROIdataConversion); -REGISTER_TEST(otbSVMCrossValidationCostFunctionNew); -REGISTER_TEST(otbExhaustiveExponentialOptimizerNew); + REGISTER_TEST(otbROIdataConversionNew); + REGISTER_TEST(otbROIdataConversion); + REGISTER_TEST(otbSVMCrossValidationCostFunctionNew); + REGISTER_TEST(otbExhaustiveExponentialOptimizerNew); } diff --git a/Testing/Code/Learning/otbPeriodicSOM.cxx b/Testing/Code/Learning/otbPeriodicSOM.cxx index 1c24ba7b32..52c6f4b6f3 100644 --- a/Testing/Code/Learning/otbPeriodicSOM.cxx +++ b/Testing/Code/Learning/otbPeriodicSOM.cxx @@ -29,28 +29,27 @@ int otbPeriodicSOM(int argc, char* argv[]) { const unsigned int Dimension = 2; - char * inputFileName = argv[1]; - char * outputFileName = argv[2]; - unsigned int sizeX = atoi(argv[3]); - unsigned int sizeY = atoi(argv[4]); - unsigned int neighInitX = atoi(argv[5]); - unsigned int neighInitY= atoi(argv[6]); - unsigned int nbIterations= atoi(argv[7]); - double betaInit = atof(argv[8]); - double betaEnd= atof(argv[9]); - double initValue = atof(argv[10]); - - - typedef double ComponentType; - typedef itk::VariableLengthVector<ComponentType> PixelType; - typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> MapType; - typedef otb::VectorImage<ComponentType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::Statistics::ListSample<PixelType> ListSampleType; - - typedef otb::PeriodicSOM<ListSampleType,MapType> SOMType; - typedef otb::ImageFileWriter<MapType> WriterType; + char * inputFileName = argv[1]; + char * outputFileName = argv[2]; + unsigned int sizeX = atoi(argv[3]); + unsigned int sizeY = atoi(argv[4]); + unsigned int neighInitX = atoi(argv[5]); + unsigned int neighInitY = atoi(argv[6]); + unsigned int nbIterations = atoi(argv[7]); + double betaInit = atof(argv[8]); + double betaEnd = atof(argv[9]); + double initValue = atof(argv[10]); + + typedef double ComponentType; + typedef itk::VariableLengthVector<ComponentType> PixelType; + typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> MapType; + typedef otb::VectorImage<ComponentType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::Statistics::ListSample<PixelType> ListSampleType; + + typedef otb::PeriodicSOM<ListSampleType, MapType> SOMType; + typedef otb::ImageFileWriter<MapType> WriterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); @@ -58,24 +57,24 @@ int otbPeriodicSOM(int argc, char* argv[]) ListSampleType::Pointer listSample = ListSampleType::New(); - itk::ImageRegionIterator<ImageType> it(reader->GetOutput(),reader->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionIterator<ImageType> it(reader->GetOutput(), reader->GetOutput()->GetLargestPossibleRegion()); it.GoToBegin(); while (!it.IsAtEnd()) - { + { listSample->PushBack(it.Get()); ++it; - } + } - std::cout<<"LIST SAMPLE SIZE: "<<listSample->GetMeasurementVectorSize()<<std::endl; + std::cout << "LIST SAMPLE SIZE: " << listSample->GetMeasurementVectorSize() << std::endl; // Instantiation SOMType::Pointer som = SOMType::New(); som->SetListSample(listSample); SOMType::SizeType size; - size[0]=sizeX; - size[1]=sizeY; + size[0] = sizeX; + size[1] = sizeY; som->SetMapSize(size); SOMType::SizeType radius; radius[0] = neighInitX; diff --git a/Testing/Code/Learning/otbPeriodicSOMNew.cxx b/Testing/Code/Learning/otbPeriodicSOMNew.cxx index 46b883c6f9..c514b5edb2 100644 --- a/Testing/Code/Learning/otbPeriodicSOMNew.cxx +++ b/Testing/Code/Learning/otbPeriodicSOMNew.cxx @@ -25,17 +25,16 @@ int otbPeriodicSOMNew(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef float ComponentType; - typedef itk::VariableLengthVector<ComponentType> PixelType; - typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> SOMMapType; + typedef float ComponentType; + typedef itk::VariableLengthVector<ComponentType> PixelType; + typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> SOMMapType; // typedef itk::Statistics::ImageToListAdaptor<SOMMapType> AdaptorType; - typedef itk::Statistics::ListSample<PixelType> ListSampleType; - typedef otb::PeriodicSOM<ListSampleType,SOMMapType> SOMType; + typedef itk::Statistics::ListSample<PixelType> ListSampleType; + typedef otb::PeriodicSOM<ListSampleType, SOMMapType> SOMType; // Instantiation SOMType::Pointer som = SOMType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Learning/otbROIdataConversion.cxx b/Testing/Code/Learning/otbROIdataConversion.cxx index f9c8200373..091a61568d 100644 --- a/Testing/Code/Learning/otbROIdataConversion.cxx +++ b/Testing/Code/Learning/otbROIdataConversion.cxx @@ -28,44 +28,43 @@ #include "itkImageRegionIterator.h" #include <iostream> -int otbROIdataConversion( int argc, char* argv[] ) +int otbROIdataConversion(int argc, char* argv[]) { - typedef double PixelType; - const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > InputImageType; + typedef double PixelType; + const unsigned int Dimension = 2; + typedef otb::Image<PixelType, Dimension> InputImageType; typedef otb::ROIdataConversion<InputImageType, InputImageType> ConvertorType; typedef ConvertorType::OutputImageType OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ConvertorType::Pointer convertor = ConvertorType::New(); - ReaderType::Pointer readerIm = ReaderType::New(); - ReaderType::Pointer readerTr = ReaderType::New(); + ReaderType::Pointer readerIm = ReaderType::New(); + ReaderType::Pointer readerTr = ReaderType::New(); readerIm->SetFileName(argv[1]); readerTr->SetFileName(argv[2]); readerIm->Update(); readerTr->Update(); - convertor->SetInput( readerIm->GetOutput() ); - convertor->SetROIImage( readerTr->GetOutput() ); + convertor->SetInput(readerIm->GetOutput()); + convertor->SetROIImage(readerTr->GetOutput()); convertor->Update(); - + std::ofstream file; file.open(argv[3]); - itk::ImageRegionIterator< OutputImageType > outputIter( convertor->GetOutput(), convertor->GetOutput()->GetLargestPossibleRegion() ); + itk::ImageRegionIterator<OutputImageType> outputIter(convertor->GetOutput(), + convertor->GetOutput()->GetLargestPossibleRegion()); outputIter.GoToBegin(); - while ( !outputIter.IsAtEnd() ) - { - file <<outputIter.Get()<<" "; + while (!outputIter.IsAtEnd()) + { + file << outputIter.Get() << " "; ++outputIter; - } - file <<std::endl; + } + file << std::endl; file.close(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbROIdataConversionNew.cxx b/Testing/Code/Learning/otbROIdataConversionNew.cxx index 6c9881d3af..7826d22ad0 100644 --- a/Testing/Code/Learning/otbROIdataConversionNew.cxx +++ b/Testing/Code/Learning/otbROIdataConversionNew.cxx @@ -24,18 +24,14 @@ #include "otbImage.h" #include "otbVectorImage.h" -int otbROIdataConversionNew( int argc, char* argv[] ) +int otbROIdataConversionNew(int argc, char* argv[]) { - typedef double PixelType; - const unsigned int Dimension = 2; - typedef otb::VectorImage< PixelType, Dimension > InputImageType; + typedef double PixelType; + const unsigned int Dimension = 2; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; typedef otb::ROIdataConversion<InputImageType, InputImageType> ConvertorType; - ConvertorType::Pointer convertor = ConvertorType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSEMClassifierNew.cxx b/Testing/Code/Learning/otbSEMClassifierNew.cxx index 44fccd7ec5..b8f6f8ac13 100644 --- a/Testing/Code/Learning/otbSEMClassifierNew.cxx +++ b/Testing/Code/Learning/otbSEMClassifierNew.cxx @@ -30,23 +30,19 @@ #include <iostream> - -int otbSEMClassifierNew( int argc, char* argv[] ) +int otbSEMClassifierNew(int argc, char* argv[]) { - typedef double PixelType; - typedef otb::VectorImage< PixelType, 2 > ImageType; - typedef itk::Image< unsigned char, 2 > OutputImageType; - typedef otb::SEMClassifier< ImageType, OutputImageType > ClassifType; - typedef itk::Statistics::ListSample< ImageType::PixelType > SampleType; - typedef itk::Statistics::Subsample< SampleType > ClassSampleType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef itk::Image<unsigned char, 2> OutputImageType; + typedef otb::SEMClassifier<ImageType, OutputImageType> ClassifType; + typedef itk::Statistics::ListSample<ImageType::PixelType> SampleType; + typedef itk::Statistics::Subsample<SampleType> ClassSampleType; - typedef otb::Statistics::ModelComponentBase< ClassSampleType > ComponentType; + typedef otb::Statistics::ModelComponentBase<ClassSampleType> ComponentType; - ClassifType::Pointer classifier = ClassifType::New(); + ClassifType::Pointer classifier = ClassifType::New(); ComponentType::Pointer component = ComponentType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSOM.cxx b/Testing/Code/Learning/otbSOM.cxx index 983cc2bea7..12952e3117 100644 --- a/Testing/Code/Learning/otbSOM.cxx +++ b/Testing/Code/Learning/otbSOM.cxx @@ -29,28 +29,27 @@ int otbSOM(int argc, char* argv[]) { const unsigned int Dimension = 2; - char * inputFileName = argv[1]; - char * outputFileName = argv[2]; - unsigned int sizeX = atoi(argv[3]); - unsigned int sizeY = atoi(argv[4]); - unsigned int neighInitX = atoi(argv[5]); - unsigned int neighInitY= atoi(argv[6]); - unsigned int nbIterations= atoi(argv[7]); - double betaInit = atof(argv[8]); - double betaEnd= atof(argv[9]); - double initValue = atof(argv[10]); - - - typedef double ComponentType; - typedef itk::VariableLengthVector<ComponentType> PixelType; - typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> MapType; - typedef otb::VectorImage<ComponentType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::Statistics::ListSample<PixelType> ListSampleType; - - typedef otb::SOM<ListSampleType,MapType> SOMType; - typedef otb::ImageFileWriter<MapType> WriterType; + char * inputFileName = argv[1]; + char * outputFileName = argv[2]; + unsigned int sizeX = atoi(argv[3]); + unsigned int sizeY = atoi(argv[4]); + unsigned int neighInitX = atoi(argv[5]); + unsigned int neighInitY = atoi(argv[6]); + unsigned int nbIterations = atoi(argv[7]); + double betaInit = atof(argv[8]); + double betaEnd = atof(argv[9]); + double initValue = atof(argv[10]); + + typedef double ComponentType; + typedef itk::VariableLengthVector<ComponentType> PixelType; + typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> MapType; + typedef otb::VectorImage<ComponentType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef itk::Statistics::ListSample<PixelType> ListSampleType; + + typedef otb::SOM<ListSampleType, MapType> SOMType; + typedef otb::ImageFileWriter<MapType> WriterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); @@ -58,24 +57,24 @@ int otbSOM(int argc, char* argv[]) ListSampleType::Pointer listSample = ListSampleType::New(); - itk::ImageRegionIterator<ImageType> it(reader->GetOutput(),reader->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionIterator<ImageType> it(reader->GetOutput(), reader->GetOutput()->GetLargestPossibleRegion()); it.GoToBegin(); while (!it.IsAtEnd()) - { + { listSample->PushBack(it.Get()); ++it; - } + } - std::cout<<"LIST SAMPLE SIZE: "<<listSample->GetMeasurementVectorSize()<<std::endl; + std::cout << "LIST SAMPLE SIZE: " << listSample->GetMeasurementVectorSize() << std::endl; // Instantiation SOMType::Pointer som = SOMType::New(); som->SetListSample(listSample); SOMType::SizeType size; - size[0]=sizeX; - size[1]=sizeY; + size[0] = sizeX; + size[1] = sizeY; som->SetMapSize(size); SOMType::SizeType radius; radius[0] = neighInitX; @@ -92,6 +91,5 @@ int otbSOM(int argc, char* argv[]) writer->SetInput(som->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Learning/otbSOMActivationBuilder.cxx b/Testing/Code/Learning/otbSOMActivationBuilder.cxx index 53ab86c53a..34bd32651b 100644 --- a/Testing/Code/Learning/otbSOMActivationBuilder.cxx +++ b/Testing/Code/Learning/otbSOMActivationBuilder.cxx @@ -30,26 +30,26 @@ int otbSOMActivationBuilder(int argc, char* argv[]) { const unsigned int Dimension = 2; - char * vectorSetFileName = argv[1]; - char * mapFileName = argv[2]; - char * outputFileName = argv[3]; + char * vectorSetFileName = argv[1]; + char * mapFileName = argv[2]; + char * outputFileName = argv[3]; - typedef float ComponentType; - typedef unsigned char OutputPixelType; - typedef itk::VariableLengthVector<ComponentType> PixelType; + typedef float ComponentType; + typedef unsigned char OutputPixelType; + typedef itk::VariableLengthVector<ComponentType> PixelType; typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> MapType; - typedef otb::ImageFileReader<MapType> MapReaderType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> MapType; + typedef otb::ImageFileReader<MapType> MapReaderType; - typedef otb::VectorImage<ComponentType,Dimension> InputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef itk::Statistics::ListSample<PixelType> ListSampleType; + typedef otb::VectorImage<ComponentType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef itk::Statistics::ListSample<PixelType> ListSampleType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::SOMActivationBuilder<ListSampleType,MapType,OutputImageType> SOMActivationBuilderType; + typedef otb::SOMActivationBuilder<ListSampleType, MapType, OutputImageType> SOMActivationBuilderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(vectorSetFileName); @@ -57,15 +57,15 @@ int otbSOMActivationBuilder(int argc, char* argv[]) ListSampleType::Pointer listSample = ListSampleType::New(); - itk::ImageRegionIterator<InputImageType> it(reader->GetOutput(),reader->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionIterator<InputImageType> it(reader->GetOutput(), reader->GetOutput()->GetLargestPossibleRegion()); it.GoToBegin(); while (!it.IsAtEnd()) - { + { listSample->PushBack(it.Get()); ++it; - } + } MapReaderType::Pointer mapReader = MapReaderType::New(); mapReader->SetFileName(mapFileName); @@ -79,6 +79,5 @@ int otbSOMActivationBuilder(int argc, char* argv[]) writer->SetInput(somAct->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Learning/otbSOMActivationBuilderNew.cxx b/Testing/Code/Learning/otbSOMActivationBuilderNew.cxx index d86a560376..47b765c5d0 100644 --- a/Testing/Code/Learning/otbSOMActivationBuilderNew.cxx +++ b/Testing/Code/Learning/otbSOMActivationBuilderNew.cxx @@ -27,21 +27,20 @@ int otbSOMActivationBuilderNew(int argc, char* argv[]) { - const unsigned int Dimension =2; - typedef float ComponentType; - typedef unsigned char OutputPixelType; - typedef itk::VariableLengthVector<ComponentType> PixelType; + const unsigned int Dimension = 2; + typedef float ComponentType; + typedef unsigned char OutputPixelType; + typedef itk::VariableLengthVector<ComponentType> PixelType; typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> MapType; - typedef otb::VectorImage<ComponentType,Dimension> InputImageType; - typedef itk::Statistics::ListSample<PixelType> ListSampleType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::SOMActivationBuilder<ListSampleType,MapType,OutputImageType> SOMActivationBuilderType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> MapType; + typedef otb::VectorImage<ComponentType, Dimension> InputImageType; + typedef itk::Statistics::ListSample<PixelType> ListSampleType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::SOMActivationBuilder<ListSampleType, MapType, OutputImageType> SOMActivationBuilderType; // Instantiation SOMActivationBuilderType::Pointer somAct = SOMActivationBuilderType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Learning/otbSOMClassifier.cxx b/Testing/Code/Learning/otbSOMClassifier.cxx index f6016f86be..b13bd64f3b 100644 --- a/Testing/Code/Learning/otbSOMClassifier.cxx +++ b/Testing/Code/Learning/otbSOMClassifier.cxx @@ -30,56 +30,56 @@ #include "itkImageRegionIterator.h" #include "itkListSample.h" -int otbSOMClassifier(int argc, char* argv[] ) +int otbSOMClassifier(int argc, char* argv[]) { if (argc != 4) - { + { std::cout << "Usage : " << argv[0] << " inputImage modelFile outputImage" << std::endl; return EXIT_FAILURE; - } + } const char * imageFilename = argv[1]; const char * mapFilename = argv[2]; const char * outputFilename = argv[3]; - typedef double InputPixelType; - typedef int LabelPixelType; - const unsigned int Dimension = 2; - - typedef itk::VariableLengthVector<InputPixelType> PixelType; - typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> SOMMapType; - typedef otb::VectorImage<InputPixelType,Dimension> InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileReader<SOMMapType> SOMReaderType; - typedef itk::Statistics::ListSample< PixelType > SampleType; - typedef otb::SOMClassifier<SampleType,SOMMapType,LabelPixelType> ClassifierType; - typedef otb::Image<LabelPixelType, Dimension > OutputImageType; - typedef itk::ImageRegionIterator< OutputImageType> OutputIteratorType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef double InputPixelType; + typedef int LabelPixelType; + const unsigned int Dimension = 2; + + typedef itk::VariableLengthVector<InputPixelType> PixelType; + typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> SOMMapType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<SOMMapType> SOMReaderType; + typedef itk::Statistics::ListSample<PixelType> SampleType; + typedef otb::SOMClassifier<SampleType, SOMMapType, LabelPixelType> ClassifierType; + typedef otb::Image<LabelPixelType, Dimension> OutputImageType; + typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( imageFilename ); + reader->SetFileName(imageFilename); reader->Update(); std::cout << "Image read" << std::endl; SOMReaderType::Pointer somreader = SOMReaderType::New(); somreader->SetFileName(mapFilename); somreader->Update(); - std::cout<<"SOM map read"<<std::endl; + std::cout << "SOM map read" << std::endl; SampleType::Pointer listSample = SampleType::New(); - itk::ImageRegionIterator<InputImageType> it(reader->GetOutput(),reader->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionIterator<InputImageType> it(reader->GetOutput(), reader->GetOutput()->GetLargestPossibleRegion()); it.GoToBegin(); while (!it.IsAtEnd()) - { + { listSample->PushBack(it.Get()); ++it; - } + } ClassifierType::Pointer classifier = ClassifierType::New(); classifier->SetSample(listSample.GetPointer()); @@ -87,30 +87,27 @@ int otbSOMClassifier(int argc, char* argv[] ) classifier->Update(); OutputImageType::Pointer outputImage = OutputImageType::New(); - outputImage->SetRegions( reader->GetOutput()->GetLargestPossibleRegion()); + outputImage->SetRegions(reader->GetOutput()->GetLargestPossibleRegion()); outputImage->Allocate(); - ClassifierType::OutputType* membershipSample = classifier->GetOutput(); + ClassifierType::OutputType* membershipSample = classifier->GetOutput(); ClassifierType::OutputType::ConstIterator m_iter = membershipSample->Begin(); ClassifierType::OutputType::ConstIterator m_last = membershipSample->End(); - OutputIteratorType outIt(outputImage,outputImage->GetLargestPossibleRegion()); + OutputIteratorType outIt(outputImage, outputImage->GetLargestPossibleRegion()); outIt.GoToBegin(); while (m_iter != m_last && !outIt.IsAtEnd()) - { + { outIt.Set(m_iter.GetClassLabel()); ++m_iter; ++outIt; - } + } WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFilename); writer->SetInput(outputImage); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSOMClassifierNew.cxx b/Testing/Code/Learning/otbSOMClassifierNew.cxx index 079fe921e6..9d43838f97 100644 --- a/Testing/Code/Learning/otbSOMClassifierNew.cxx +++ b/Testing/Code/Learning/otbSOMClassifierNew.cxx @@ -26,23 +26,20 @@ #include "itkListSample.h" #include "otbVectorImage.h" -int otbSOMClassifierNew(int argc, char* argv[] ) +int otbSOMClassifierNew(int argc, char* argv[]) { - typedef double InputPixelType; - typedef int LabelPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef int LabelPixelType; + const unsigned int Dimension = 2; - typedef itk::VariableLengthVector<InputPixelType> PixelType; - typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> SOMMapType; - typedef otb::VectorImage<InputPixelType,Dimension> InputImageType; - typedef itk::Statistics::ListSample< PixelType > SampleType; - typedef otb::SOMClassifier<SampleType,SOMMapType,LabelPixelType> ClassifierType; + typedef itk::VariableLengthVector<InputPixelType> PixelType; + typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> SOMMapType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef itk::Statistics::ListSample<PixelType> SampleType; + typedef otb::SOMClassifier<SampleType, SOMMapType, LabelPixelType> ClassifierType; ClassifierType::Pointer classifier = ClassifierType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSOMImageClassificationFilter.cxx b/Testing/Code/Learning/otbSOMImageClassificationFilter.cxx index d630f81031..df3f439d38 100644 --- a/Testing/Code/Learning/otbSOMImageClassificationFilter.cxx +++ b/Testing/Code/Learning/otbSOMImageClassificationFilter.cxx @@ -28,18 +28,17 @@ int otbSOMImageClassificationFilter(int argc, char * argv[]) const char * somfname = argv[2]; const char * outfname = argv[3]; - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; typedef double PixelType; typedef unsigned short LabeledPixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType; - typedef otb::SOMMap<ImageType::PixelType> SOMMapType; - typedef otb::SOMImageClassificationFilter<ImageType,LabeledImageType,SOMMapType> ClassificationFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileReader<SOMMapType> SOMReaderType; - typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType; - + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::Image<LabeledPixelType, Dimension> LabeledImageType; + typedef otb::SOMMap<ImageType::PixelType> SOMMapType; + typedef otb::SOMImageClassificationFilter<ImageType, LabeledImageType, SOMMapType> ClassificationFilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<SOMMapType> SOMReaderType; + typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType; // Instantiating object ClassificationFilterType::Pointer filter = ClassificationFilterType::New(); diff --git a/Testing/Code/Learning/otbSOMImageClassificationFilterNew.cxx b/Testing/Code/Learning/otbSOMImageClassificationFilterNew.cxx index b01fb3240a..acb31a1cd4 100644 --- a/Testing/Code/Learning/otbSOMImageClassificationFilterNew.cxx +++ b/Testing/Code/Learning/otbSOMImageClassificationFilterNew.cxx @@ -22,14 +22,14 @@ int otbSOMImageClassificationFilterNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; typedef double PixelType; typedef unsigned short LabeledPixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType; - typedef otb::SOMMap<ImageType::PixelType> SOMMapType; - typedef otb::SOMImageClassificationFilter<ImageType,LabeledImageType,SOMMapType> ClassificationFilterType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::Image<LabeledPixelType, Dimension> LabeledImageType; + typedef otb::SOMMap<ImageType::PixelType> SOMMapType; + typedef otb::SOMImageClassificationFilter<ImageType, LabeledImageType, SOMMapType> ClassificationFilterType; // Instantiating object ClassificationFilterType::Pointer filter = ClassificationFilterType::New(); diff --git a/Testing/Code/Learning/otbSOMMap.cxx b/Testing/Code/Learning/otbSOMMap.cxx index 894e7efca0..11dec3ec6f 100644 --- a/Testing/Code/Learning/otbSOMMap.cxx +++ b/Testing/Code/Learning/otbSOMMap.cxx @@ -24,19 +24,18 @@ int otbSOMMap(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef float InternalPixelType; - typedef itk::VariableLengthVector<InternalPixelType> PixelType; - typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> SOMMapType; - + typedef float InternalPixelType; + typedef itk::VariableLengthVector<InternalPixelType> PixelType; + typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> SOMMapType; // Instantiation SOMMapType::Pointer somMap = SOMMapType::New(); // Allocation of the som map SOMMapType::RegionType region; - SOMMapType::IndexType index; - SOMMapType::SizeType size; + SOMMapType::IndexType index; + SOMMapType::SizeType size; index.Fill(0); size.Fill(64); region.SetIndex(index); @@ -56,16 +55,15 @@ int otbSOMMap(int argc, char* argv[]) winner.SetSize(3); winner.Fill(1); index.Fill(32); - somMap->SetPixel(index,winner); + somMap->SetPixel(index, winner); // Test of the GetWinner method SOMMapType::IndexType winnerIndex = somMap->GetWinner(winner); - if (winnerIndex!=index) - { - std::cout<<"Bad GetWinner function return."<<std::endl; + if (winnerIndex != index) + { + std::cout << "Bad GetWinner function return." << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/Learning/otbSOMMapNew.cxx b/Testing/Code/Learning/otbSOMMapNew.cxx index 326b7f4a02..5b2cfd0969 100644 --- a/Testing/Code/Learning/otbSOMMapNew.cxx +++ b/Testing/Code/Learning/otbSOMMapNew.cxx @@ -23,10 +23,10 @@ int otbSOMMapNew(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef float ComponentType; - typedef itk::RGBPixel<ComponentType> PixelType; - typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> SOMMapType; + typedef float ComponentType; + typedef itk::RGBPixel<ComponentType> PixelType; + typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> SOMMapType; // Instantiation SOMMapType::Pointer somMap = SOMMapType::New(); diff --git a/Testing/Code/Learning/otbSOMNew.cxx b/Testing/Code/Learning/otbSOMNew.cxx index b702b3376b..841d2b0d0f 100644 --- a/Testing/Code/Learning/otbSOMNew.cxx +++ b/Testing/Code/Learning/otbSOMNew.cxx @@ -25,17 +25,16 @@ int otbSOMNew(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef float ComponentType; - typedef itk::VariableLengthVector<ComponentType> PixelType; - typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; - typedef otb::SOMMap<PixelType,DistanceType,Dimension> SOMMapType; + typedef float ComponentType; + typedef itk::VariableLengthVector<ComponentType> PixelType; + typedef itk::Statistics::EuclideanDistance<PixelType> DistanceType; + typedef otb::SOMMap<PixelType, DistanceType, Dimension> SOMMapType; // typedef itk::Statistics::ImageToListAdaptor<SOMMapType> AdaptorType; typedef itk::Statistics::ListSample<PixelType> ListSampleType; - typedef otb::SOM<ListSampleType,SOMMapType> SOMType; + typedef otb::SOM<ListSampleType, SOMMapType> SOMType; // Instantiation SOMType::Pointer som = SOMType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Learning/otbSOMWithMissingValueNew.cxx b/Testing/Code/Learning/otbSOMWithMissingValueNew.cxx index 1718f03ba7..a2dc08bfcb 100644 --- a/Testing/Code/Learning/otbSOMWithMissingValueNew.cxx +++ b/Testing/Code/Learning/otbSOMWithMissingValueNew.cxx @@ -23,32 +23,29 @@ #include "itkVariableLengthVector.h" #include "itkListSample.h" - #include "otbSOMMap.h" #include "otbPeriodicSOM.h" #include "otbSOMWithMissingValue.h" #include "otbFlexibleDistanceWithMissingValue.h" -int otbSOMWithMissingValueNew ( int argc, char * argv[] ) +int otbSOMWithMissingValueNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage< PixelType, Dimension > ImageType; - typedef ImageType::PixelType VectorType; - - typedef otb::Statistics::FlexibleDistanceWithMissingValue< VectorType > DistanceType; - - typedef otb::SOMMap< VectorType, DistanceType, Dimension > MapType; - typedef itk::Statistics::ListSample< VectorType > SampleListType; - typedef otb::Functor::CzihoSOMLearningBehaviorFunctor LearningBehaviorFunctorType; - typedef otb::Functor::CzihoSOMNeighborhoodBehaviorFunctor NeighborhoodBehaviorFunctorType; - typedef otb::SOMWithMissingValue< SampleListType, MapType, - LearningBehaviorFunctorType, NeighborhoodBehaviorFunctorType > SOMType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PixelType VectorType; + + typedef otb::Statistics::FlexibleDistanceWithMissingValue<VectorType> DistanceType; + + typedef otb::SOMMap<VectorType, DistanceType, Dimension> MapType; + typedef itk::Statistics::ListSample<VectorType> SampleListType; + typedef otb::Functor::CzihoSOMLearningBehaviorFunctor LearningBehaviorFunctorType; + typedef otb::Functor::CzihoSOMNeighborhoodBehaviorFunctor NeighborhoodBehaviorFunctorType; + typedef otb::SOMWithMissingValue<SampleListType, MapType, + LearningBehaviorFunctorType, NeighborhoodBehaviorFunctorType> SOMType; SOMType::Pointer som = SOMType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSOMbasedImageFilterNew.cxx b/Testing/Code/Learning/otbSOMbasedImageFilterNew.cxx index cca67624ed..429e9233a4 100644 --- a/Testing/Code/Learning/otbSOMbasedImageFilterNew.cxx +++ b/Testing/Code/Learning/otbSOMbasedImageFilterNew.cxx @@ -25,19 +25,18 @@ #include "otbFlexibleDistanceWithMissingValue.h" #include "otbSOMbasedImageFilter.h" -int otbSOMbasedImageFilterNew ( int argc, char * argv[] ) +int otbSOMbasedImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage< PixelType, Dimension > ImageType; - typedef ImageType::PixelType VectorType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef ImageType::PixelType VectorType; - typedef otb::Statistics::FlexibleDistanceWithMissingValue< VectorType > DistanceType; + typedef otb::Statistics::FlexibleDistanceWithMissingValue<VectorType> DistanceType; - typedef otb::SOMbasedImageFilter< ImageType, ImageType, DistanceType, ImageType > - FilterType; - FilterType::Pointer somFilter = FilterType::New(); + typedef otb::SOMbasedImageFilter<ImageType, ImageType, DistanceType, ImageType> + FilterType; + FilterType::Pointer somFilter = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Learning/otbSVMClassifierImage.cxx b/Testing/Code/Learning/otbSVMClassifierImage.cxx index bf379f2379..d745adb0a4 100644 --- a/Testing/Code/Learning/otbSVMClassifierImage.cxx +++ b/Testing/Code/Learning/otbSVMClassifierImage.cxx @@ -29,10 +29,8 @@ #include "itkPointSetToListAdaptor.h" #include "itkSubsample.h"*/ - #include "itkListSample.h" - #include "otbImage.h" #include "otbVectorImage.h" #include "itkImageToListAdaptor.h" @@ -48,28 +46,27 @@ namespace otb class Linear : public GenericKernelFunctorBase { public: - Linear(): GenericKernelFunctorBase() {}; - virtual ~Linear() {}; + Linear() : GenericKernelFunctorBase() {} + virtual ~Linear() {} - virtual double operator()(const svm_node *x, const svm_node *y, const svm_parameter& param)const + virtual double operator ()(const svm_node *x, const svm_node *y, const svm_parameter& param) const { - return this->dot(x,y); + return this->dot(x, y); } }; } - -int otbSVMClassifierImage(int argc, char* argv[] ) +int otbSVMClassifierImage(int argc, char* argv[]) { namespace stat = itk::Statistics; if (argc != 4) - { + { std::cout << "Usage : " << argv[0] << " inputImage modelFile outputImage" << std::endl; return EXIT_FAILURE; - } + } const char * imageFilename = argv[1]; const char * modelFilename = argv[2]; @@ -77,58 +74,55 @@ int otbSVMClassifierImage(int argc, char* argv[] ) /** Read the input image and build the sample */ - typedef double InputPixelType; - typedef std::vector<InputPixelType> InputVectorType; - typedef int LabelPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef std::vector<InputPixelType> InputVectorType; + typedef int LabelPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< itk::FixedArray<InputPixelType,3>, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::Image<itk::FixedArray<InputPixelType, 3>, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( imageFilename ); + reader->SetFileName(imageFilename); reader->Update(); - typedef itk::Statistics::ImageToListAdaptor< InputImageType > SampleType; + typedef itk::Statistics::ImageToListAdaptor<InputImageType> SampleType; SampleType::Pointer sample = SampleType::New(); sample->SetImage(reader->GetOutput()); - /** preparing classifier and decision rule object */ - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer model = ModelType::New(); - otb::Linear lFunctor; model->SetKernelFunctor(&lFunctor); - model->LoadModel( modelFilename ); + model->LoadModel(modelFilename); int numberOfClasses = model->GetNumberOfClasses(); - typedef otb::SVMClassifier< SampleType, LabelPixelType > ClassifierType; + typedef otb::SVMClassifier<SampleType, LabelPixelType> ClassifierType; ClassifierType::Pointer classifier = ClassifierType::New(); classifier->SetNumberOfClasses(numberOfClasses); - classifier->SetModel( model ); + classifier->SetModel(model); classifier->SetSample(sample.GetPointer()); classifier->Update(); /* Build the class map */ - otbGenericMsgDebugMacro( << "Output image creation" ); - - typedef ClassifierType::ClassLabelType OutputPixelType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + otbGenericMsgDebugMacro(<< "Output image creation"); + typedef ClassifierType::ClassLabelType OutputPixelType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; OutputImageType::Pointer outputImage = OutputImageType::New(); - typedef itk::Index<Dimension> myIndexType; - typedef itk::Size<Dimension> mySizeType; - typedef itk::ImageRegion<Dimension> myRegionType; + typedef itk::Index<Dimension> myIndexType; + typedef itk::Size<Dimension> mySizeType; + typedef itk::ImageRegion<Dimension> myRegionType; mySizeType size; size[0] = reader->GetOutput()->GetRequestedRegion().GetSize()[0]; @@ -139,64 +133,57 @@ int otbSVMClassifierImage(int argc, char* argv[] ) start[1] = 0; myRegionType region; - region.SetIndex( start ); - region.SetSize( size ); + region.SetIndex(start); + region.SetSize(size); - outputImage->SetRegions( region ); + outputImage->SetRegions(region); outputImage->Allocate(); - - otbGenericMsgDebugMacro( << "classifier get output" ); + otbGenericMsgDebugMacro(<< "classifier get output"); ClassifierType::OutputType* membershipSample = classifier->GetOutput(); - otbGenericMsgDebugMacro( << "Sample iterators" ); + otbGenericMsgDebugMacro(<< "Sample iterators"); ClassifierType::OutputType::ConstIterator m_iter = membershipSample->Begin(); ClassifierType::OutputType::ConstIterator m_last = membershipSample->End(); - otbGenericMsgDebugMacro( << "Image iterator" ); - typedef itk::ImageRegionIterator< OutputImageType> OutputIteratorType; - OutputIteratorType outIt( outputImage, - outputImage->GetBufferedRegion() ); + otbGenericMsgDebugMacro(<< "Image iterator"); + typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType; + OutputIteratorType outIt(outputImage, + outputImage->GetBufferedRegion()); outIt.GoToBegin(); - - otbGenericMsgDebugMacro( << "Iteration for output image = " << (membershipSample->Size()) ); + otbGenericMsgDebugMacro(<< "Iteration for output image = " << (membershipSample->Size())); while (m_iter != m_last && !outIt.IsAtEnd()) - { + { outIt.Set(m_iter.GetClassLabel()); ++m_iter; ++outIt; - } - + } - typedef otb::Image< unsigned char, Dimension > FileImageType; + typedef otb::Image<unsigned char, Dimension> FileImageType; - - typedef itk::RescaleIntensityImageFilter< OutputImageType, - FileImageType > RescalerType; + typedef itk::RescaleIntensityImageFilter<OutputImageType, + FileImageType> RescalerType; RescalerType::Pointer rescaler = RescalerType::New(); - rescaler->SetOutputMinimum( itk::NumericTraits< unsigned char >::min()); - rescaler->SetOutputMaximum( itk::NumericTraits< unsigned char >::max()); + rescaler->SetOutputMinimum(itk::NumericTraits<unsigned char>::min()); + rescaler->SetOutputMaximum(itk::NumericTraits<unsigned char>::max()); - rescaler->SetInput( outputImage ); + rescaler->SetInput(outputImage); - typedef otb::ImageFileWriter< FileImageType > WriterType; + typedef otb::ImageFileWriter<FileImageType> WriterType; WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( rescaler->GetOutput() ); + writer->SetFileName(outputFilename); + writer->SetInput(rescaler->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMClassifierNew.cxx b/Testing/Code/Learning/otbSVMClassifierNew.cxx index 626ca263b8..45dbb4417a 100644 --- a/Testing/Code/Learning/otbSVMClassifierNew.cxx +++ b/Testing/Code/Learning/otbSVMClassifierNew.cxx @@ -25,21 +25,18 @@ #include "itkSubsample.h" #include "otbSVMClassifier.h" -int otbSVMClassifierNew(int argc, char* argv[] ) +int otbSVMClassifierNew(int argc, char* argv[]) { - typedef double InputPixelType; - typedef int LabelPixelType; - typedef itk::PointSet< InputPixelType, 2 > PointSetType; + typedef double InputPixelType; + typedef int LabelPixelType; + typedef itk::PointSet<InputPixelType, 2> PointSetType; - typedef itk::Statistics::PointSetToListAdaptor< PointSetType > + typedef itk::Statistics::PointSetToListAdaptor<PointSetType> DataSampleType; - - typedef otb::SVMClassifier< DataSampleType, LabelPixelType > ClassifierType; + typedef otb::SVMClassifier<DataSampleType, LabelPixelType> ClassifierType; ClassifierType::Pointer classifier = ClassifierType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMClassifierPointSet.cxx b/Testing/Code/Learning/otbSVMClassifierPointSet.cxx index 07147d7055..125ac99439 100644 --- a/Testing/Code/Learning/otbSVMClassifierPointSet.cxx +++ b/Testing/Code/Learning/otbSVMClassifierPointSet.cxx @@ -30,97 +30,90 @@ #include "itkListSample.h" #include "otbSVMClassifier.h" -int otbSVMClassifierPointSet(int argc, char* argv[] ) +int otbSVMClassifierPointSet(int argc, char* argv[]) { namespace stat = itk::Statistics; if (argc != 2) - { + { std::cout << "Usage : " << argv[0] << " modelFile" << std::endl; return EXIT_FAILURE; - } + } const char * modelFilename = argv[1]; std::cout << "Building the pointset" << std::endl; + typedef double InputPixelType; + typedef int LabelPixelType; + typedef std::vector<InputPixelType> InputVectorType; + const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef int LabelPixelType; - typedef std::vector<InputPixelType> InputVectorType; - const unsigned int Dimension = 2; - - typedef itk::PointSet< InputVectorType, Dimension > + typedef itk::PointSet<InputVectorType, Dimension> MeasurePointSetType; - MeasurePointSetType::Pointer mPSet = MeasurePointSetType::New(); - typedef MeasurePointSetType::PointType MeasurePointType; + typedef MeasurePointSetType::PointType MeasurePointType; - typedef MeasurePointSetType::PointsContainer MeasurePointsContainer; + typedef MeasurePointSetType::PointsContainer MeasurePointsContainer; MeasurePointsContainer::Pointer mCont = MeasurePointsContainer::New(); unsigned int pointId; - for (pointId = 0; pointId<20; pointId++) - { + for (pointId = 0; pointId < 20; pointId++) + { MeasurePointType mP; mP[0] = pointId; mP[1] = pointId; - InputVectorType measure; //measure.push_back(vcl_pow(pointId,2.0)); - measure.push_back(double(2.0*pointId)); + measure.push_back(double(2.0 * pointId)); measure.push_back(double(-10)); + mCont->InsertElement(pointId, mP); + mPSet->SetPointData(pointId, measure); - mCont->InsertElement( pointId , mP ); - mPSet->SetPointData( pointId, measure ); + } - - } - - mPSet->SetPoints( mCont ); + mPSet->SetPoints(mCont); std::cout << "PointSet built" << std::endl; - typedef itk::Statistics::PointSetToListAdaptor< MeasurePointSetType > + typedef itk::Statistics::PointSetToListAdaptor<MeasurePointSetType> SampleType; SampleType::Pointer sample = SampleType::New(); - sample->SetPointSet( mPSet ); + sample->SetPointSet(mPSet); std::cout << "Sample set to Adaptor" << std::endl; - /** preparing classifier and decision rule object */ - typedef otb::SVMModel< SampleType::MeasurementVectorType::ValueType, LabelPixelType > ModelType; + typedef otb::SVMModel<SampleType::MeasurementVectorType::ValueType, LabelPixelType> ModelType; ModelType::Pointer model = ModelType::New(); - model->LoadModel( modelFilename ); + model->LoadModel(modelFilename); std::cout << "Model loaded" << std::endl; int numberOfClasses = model->GetNumberOfClasses(); - typedef otb::SVMClassifier< SampleType, LabelPixelType > ClassifierType; + typedef otb::SVMClassifier<SampleType, LabelPixelType> ClassifierType; ClassifierType::Pointer classifier = ClassifierType::New(); classifier->SetNumberOfClasses(numberOfClasses); - classifier->SetModel( model ); + classifier->SetModel(model); classifier->SetSample(sample.GetPointer()); classifier->Update(); /* Build the class map */ - std::cout << "classifier get output" << std::endl; ClassifierType::OutputType* membershipSample = classifier->GetOutput(); @@ -130,32 +123,26 @@ int otbSVMClassifierPointSet(int argc, char* argv[] ) ClassifierType::OutputType::ConstIterator m_last = membershipSample->End(); - double error = 0.0; pointId = 0; while (m_iter != m_last) - { + { ClassifierType::ClassLabelType label = m_iter.GetClassLabel(); InputVectorType measure; mPSet->GetPointData(pointId, &measure); - if (label != ((measure[0]+measure[1])>0) ) - error++; + if (label != ((measure[0] + measure[1]) > 0)) error++; std::cout << label << "/" << - ((measure[0]+measure[1])>0) << std::endl; - + ((measure[0] + measure[1]) > 0) << std::endl; ++pointId; ++m_iter; - } - - std::cout << "Error = " << error/pointId << std::endl; + } + std::cout << "Error = " << error / pointId << std::endl; return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMCrossValidationCostFunctionNew.cxx b/Testing/Code/Learning/otbSVMCrossValidationCostFunctionNew.cxx index 6b868da96e..f74f2bc155 100644 --- a/Testing/Code/Learning/otbSVMCrossValidationCostFunctionNew.cxx +++ b/Testing/Code/Learning/otbSVMCrossValidationCostFunctionNew.cxx @@ -27,19 +27,17 @@ #include "otbSVMModel.h" #include "otbSVMCrossValidationCostFunction.h" -int otbSVMCrossValidationCostFunctionNew( int argc, char* argv[] ) +int otbSVMCrossValidationCostFunctionNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; - typedef otb::SVMCrossValidationCostFunction<ModelType> FunctionType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; + typedef otb::SVMCrossValidationCostFunction<ModelType> FunctionType; FunctionType::Pointer function = FunctionType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMImageClassificationFilter.cxx b/Testing/Code/Learning/otbSVMImageClassificationFilter.cxx index 70b49f610d..e802910ab8 100644 --- a/Testing/Code/Learning/otbSVMImageClassificationFilter.cxx +++ b/Testing/Code/Learning/otbSVMImageClassificationFilter.cxx @@ -27,16 +27,16 @@ int otbSVMImageClassificationFilter(int argc, char * argv[]) const char * modelfname = argv[2]; const char * outfname = argv[3]; - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; typedef double PixelType; typedef unsigned short LabeledPixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType; - typedef otb::SVMImageClassificationFilter<ImageType,LabeledImageType> ClassificationFilterType; - typedef ClassificationFilterType::ModelType ModelType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::Image<LabeledPixelType, Dimension> LabeledImageType; + typedef otb::SVMImageClassificationFilter<ImageType, LabeledImageType> ClassificationFilterType; + typedef ClassificationFilterType::ModelType ModelType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType; // Instantiating object ClassificationFilterType::Pointer filter = ClassificationFilterType::New(); diff --git a/Testing/Code/Learning/otbSVMImageClassificationFilterNew.cxx b/Testing/Code/Learning/otbSVMImageClassificationFilterNew.cxx index b5a424b532..62363eaf28 100644 --- a/Testing/Code/Learning/otbSVMImageClassificationFilterNew.cxx +++ b/Testing/Code/Learning/otbSVMImageClassificationFilterNew.cxx @@ -21,14 +21,14 @@ int otbSVMImageClassificationFilterNew(int argc, char * argv[]) { - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; typedef double PixelType; typedef unsigned short LabeledPixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; - typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::Image<LabeledPixelType, Dimension> LabeledImageType; - typedef otb::SVMImageClassificationFilter<ImageType,LabeledImageType> ClassificationFilterType; + typedef otb::SVMImageClassificationFilter<ImageType, LabeledImageType> ClassificationFilterType; // Instantiating object ClassificationFilterType::Pointer object = ClassificationFilterType::New(); diff --git a/Testing/Code/Learning/otbSVMImageModelEstimatorModelAccessor.cxx b/Testing/Code/Learning/otbSVMImageModelEstimatorModelAccessor.cxx index f1d4d4fd4e..6bfdc16321 100644 --- a/Testing/Code/Learning/otbSVMImageModelEstimatorModelAccessor.cxx +++ b/Testing/Code/Learning/otbSVMImageModelEstimatorModelAccessor.cxx @@ -31,123 +31,119 @@ #include "otbImageFileReader.h" - -int otbSVMImageModelEstimatorModelAccessor( int argc, char* argv[] ) +int otbSVMImageModelEstimatorModelAccessor(int argc, char* argv[]) { const char* inputImageFileName = argv[1]; const char* trainingImageFileName = argv[2]; const char* outputModelFileName = argv[3]; - typedef double InputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef otb::Image< int, Dimension > TrainingImageType; + typedef otb::Image<int, Dimension> TrainingImageType; - typedef otb::SVMImageModelEstimator< InputImageType, - TrainingImageType > EstimatorType; + typedef otb::SVMImageModelEstimator<InputImageType, + TrainingImageType> EstimatorType; - typedef otb::ImageFileReader< InputImageType > InputReaderType; - typedef otb::ImageFileReader< TrainingImageType > TrainingReaderType; + typedef otb::ImageFileReader<InputImageType> InputReaderType; + typedef otb::ImageFileReader<TrainingImageType> TrainingReaderType; - InputReaderType::Pointer inputReader = InputReaderType::New(); + InputReaderType::Pointer inputReader = InputReaderType::New(); TrainingReaderType::Pointer trainingReader = TrainingReaderType::New(); - inputReader->SetFileName( inputImageFileName ); - trainingReader->SetFileName( trainingImageFileName ); + inputReader->SetFileName(inputImageFileName); + trainingReader->SetFileName(trainingImageFileName); inputReader->Update(); trainingReader->Update(); EstimatorType::Pointer svmEstimator = EstimatorType::New(); - svmEstimator->SetInputImage( inputReader->GetOutput() ); - svmEstimator->SetTrainingImage( trainingReader->GetOutput() ); + svmEstimator->SetInputImage(inputReader->GetOutput()); + svmEstimator->SetTrainingImage(trainingReader->GetOutput()); svmEstimator->ParametersOptimizationOff(); svmEstimator->Update(); typedef EstimatorType::SVMModelPointer SVMModelPointer; - typedef EstimatorType::SVMModelType SVMModelType; + typedef EstimatorType::SVMModelType SVMModelType; SVMModelPointer ptrModel = svmEstimator->GetModel(); - std::ofstream f; - unsigned int nbClass = ptrModel->GetNumberOfClasses(); - unsigned int nbSupportVector = ptrModel->GetNumberOfSupportVectors(); + unsigned int nbClass = ptrModel->GetNumberOfClasses(); + unsigned int nbSupportVector = ptrModel->GetNumberOfSupportVectors(); f.open(outputModelFileName); - f << "Test methods of SVMModel class:"<<std::endl; - f << " - GetNumberOfClasses() "<< nbClass<<std::endl; - f << " - GetNumberOfHyperplane() "<< ptrModel->GetNumberOfHyperplane()<<std::endl; - f << " - GetNumberOfSupportVectors() "<< nbSupportVector<<std::endl; + f << "Test methods of SVMModel class:" << std::endl; + f << " - GetNumberOfClasses() " << nbClass << std::endl; + f << " - GetNumberOfHyperplane() " << ptrModel->GetNumberOfHyperplane() << std::endl; + f << " - GetNumberOfSupportVectors() " << nbSupportVector << std::endl; - - f << " - GetSupportVectors() [nb support vector][]"<<std::endl; + f << " - GetSupportVectors() [nb support vector][]" << std::endl; svm_node ** SVs = ptrModel->GetSupportVectors(); - if ( SVs == NULL ) - { - itkGenericExceptionMacro(<<"SVs NULL"); - } - for (unsigned int i=0;i<nbSupportVector;i++) - { - if ( SVs[i] == NULL ) itkGenericExceptionMacro(<<"SVs "<<i<<" NULL"); + if (SVs == NULL) + { + itkGenericExceptionMacro(<< "SVs NULL"); + } + for (unsigned int i = 0; i < nbSupportVector; i++) + { + if (SVs[i] == NULL) itkGenericExceptionMacro(<< "SVs " << i << " NULL"); f << std::endl; - f << " SV["<<i<<"]:"; + f << " SV[" << i << "]:"; const svm_node *p = SVs[i]; /* for(unsigned int j=0;j<nbSupportVector;j++) { f << " SV["<<i<<"]["<<j<<"]:";*/ - if ( svmEstimator->GetKernelType() == PRECOMPUTED) - { - f << " "<<p->value; + if (svmEstimator->GetKernelType() == PRECOMPUTED) + { + f << " " << p->value; - } + } else - { - while (p->index != -1) { - f << " ["<<p->index << ";"<<p->value<<"] "; + while (p->index != -1) + { + f << " [" << p->index << ";" << p->value << "] "; p++; + } } - } f << std::endl; // } - } - - f << " - GetRho() [nr_class*(nr_class-1)/2]"<<std::endl; - unsigned int taille = nbClass*(nbClass-1)/2; - double * rhos = ptrModel->GetRho(); - if ( rhos == NULL ) - { - itkGenericExceptionMacro(<<"rhos NULL"); - } - f << std::setprecision(10) <<" "; - for (unsigned int i=0;i<taille;i++) - { - f << " " << rhos[i]; - } + } + f << " - GetRho() [nr_class*(nr_class-1)/2]" << std::endl; + unsigned int taille = nbClass * (nbClass - 1) / 2; + double * rhos = ptrModel->GetRho(); + if (rhos == NULL) + { + itkGenericExceptionMacro(<< "rhos NULL"); + } + f << std::setprecision(10) << " "; + for (unsigned int i = 0; i < taille; i++) + { + f << " " << rhos[i]; + } f << std::endl; - f << " - GetAlpha() [nb class-1][nb support vector]"<<std::endl; + f << " - GetAlpha() [nb class-1][nb support vector]" << std::endl; double ** alphas = ptrModel->GetAlpha(); - if ( alphas == NULL ) - { - itkGenericExceptionMacro(<<"alphas NULL"); - } - for (unsigned int i=0;i<nbClass-1;i++) - { - if ( alphas[i] == NULL ) itkGenericExceptionMacro(<<"alphas "<<i<<" NULL"); - f << " "; - for (unsigned int j=0;j<nbSupportVector;j++) + if (alphas == NULL) { + itkGenericExceptionMacro(<< "alphas NULL"); + } + for (unsigned int i = 0; i < nbClass - 1; i++) + { + if (alphas[i] == NULL) itkGenericExceptionMacro(<< "alphas " << i << " NULL"); + f << " "; + for (unsigned int j = 0; j < nbSupportVector; j++) + { f << " " << alphas[i][j]; + } } - } f << std::endl; - // f << " - Evaluate() (double) -> "<<ptrModel->Evaluate()<<std::endl; + // f << " - Evaluate() (double) -> "<<ptrModel->Evaluate()<<std::endl; // typedef SVMModelType::ValuesType ValuesType; // ValuesType _evaluateHyperplaneDistance; @@ -158,11 +154,8 @@ int otbSVMImageModelEstimatorModelAccessor( int argc, char* argv[] ) // { // f << " "<<_evaluateHyperplaneDistance[i]<<std::endl; // } - f << "end"<<std::endl; + f << "end" << std::endl; f.close(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx b/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx index 50f18054f9..83f2903cd0 100644 --- a/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx +++ b/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include "otbImage.h" #include "otbVectorImage.h" @@ -28,26 +27,21 @@ #include "otbSVMImageModelEstimator.h" - -int otbSVMImageModelEstimatorNew( int argc, char* argv[] ) +int otbSVMImageModelEstimatorNew(int argc, char* argv[]) { - typedef double InputPixelType; - const unsigned int Dimension = 2; - - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef double InputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > TrainingImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef std::vector<double> VectorType; + typedef otb::Image<InputPixelType, Dimension> TrainingImageType; - typedef otb::SVMImageModelEstimator< InputImageType, - TrainingImageType > EstimatorType; + typedef std::vector<double> VectorType; + typedef otb::SVMImageModelEstimator<InputImageType, + TrainingImageType> EstimatorType; EstimatorType::Pointer svmModel = EstimatorType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx b/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx index 1f1ac6e9bc..9889cf7fa1 100644 --- a/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx +++ b/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include "otbImage.h" #include "otbVectorImage.h" @@ -30,44 +29,40 @@ #include "otbImageFileReader.h" - -int otbSVMImageModelEstimatorTrain( int argc, char* argv[] ) +int otbSVMImageModelEstimatorTrain(int argc, char* argv[]) { const char* inputImageFileName = argv[1]; const char* trainingImageFileName = argv[2]; const char* outputModelFileName = argv[3]; const bool optimization = atoi(argv[4]); - - typedef double InputPixelType; - const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::Image< int, Dimension > TrainingImageType; - typedef std::vector<double> VectorType; - typedef otb::SVMImageModelEstimator< InputImageType, - TrainingImageType > EstimatorType; - typedef otb::ImageFileReader< InputImageType > InputReaderType; - typedef otb::ImageFileReader< TrainingImageType > TrainingReaderType; + typedef double InputPixelType; + const unsigned int Dimension = 2; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::Image<int, Dimension> TrainingImageType; + typedef std::vector<double> VectorType; + typedef otb::SVMImageModelEstimator<InputImageType, + TrainingImageType> EstimatorType; + typedef otb::ImageFileReader<InputImageType> InputReaderType; + typedef otb::ImageFileReader<TrainingImageType> TrainingReaderType; InputReaderType::Pointer inputReader = InputReaderType::New(); TrainingReaderType::Pointer trainingReader = TrainingReaderType::New(); EstimatorType::Pointer svmEstimator = EstimatorType::New(); - inputReader->SetFileName( inputImageFileName ); - trainingReader->SetFileName( trainingImageFileName ); + inputReader->SetFileName(inputImageFileName); + trainingReader->SetFileName(trainingImageFileName); inputReader->Update(); trainingReader->Update(); - svmEstimator->SetInputImage( inputReader->GetOutput() ); - svmEstimator->SetTrainingImage( trainingReader->GetOutput() ); + svmEstimator->SetInputImage(inputReader->GetOutput()); + svmEstimator->SetTrainingImage(trainingReader->GetOutput()); svmEstimator->SetParametersOptimization(optimization); svmEstimator->Update(); - otbGenericMsgDebugMacro(<<"Saving model"); + otbGenericMsgDebugMacro(<< "Saving model"); svmEstimator->GetModel()->SaveModel(outputModelFileName); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMImageModelEstimatorTrainOneClass.cxx b/Testing/Code/Learning/otbSVMImageModelEstimatorTrainOneClass.cxx index 47f944da53..633d516037 100644 --- a/Testing/Code/Learning/otbSVMImageModelEstimatorTrainOneClass.cxx +++ b/Testing/Code/Learning/otbSVMImageModelEstimatorTrainOneClass.cxx @@ -20,7 +20,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include "otbImage.h" #include "otbVectorImage.h" @@ -30,42 +29,39 @@ #include "otbImageFileReader.h" - -int otbSVMImageModelEstimatorTrainOneClass( int argc, char* argv[] ) +int otbSVMImageModelEstimatorTrainOneClass(int argc, char* argv[]) { const char* inputImageFileName = argv[1]; const char* trainingImageFileName = argv[2]; const char* outputModelFileName = argv[3]; - typedef double InputPixelType; - const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::Image< int, Dimension > TrainingImageType; - typedef std::vector<double> VectorType; - typedef otb::SVMImageModelEstimator< InputImageType, - TrainingImageType > EstimatorType; - typedef otb::ImageFileReader< InputImageType > InputReaderType; - typedef otb::ImageFileReader< TrainingImageType > TrainingReaderType; + typedef double InputPixelType; + const unsigned int Dimension = 2; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::Image<int, Dimension> TrainingImageType; + typedef std::vector<double> VectorType; + typedef otb::SVMImageModelEstimator<InputImageType, + TrainingImageType> EstimatorType; + typedef otb::ImageFileReader<InputImageType> InputReaderType; + typedef otb::ImageFileReader<TrainingImageType> TrainingReaderType; InputReaderType::Pointer inputReader = InputReaderType::New(); TrainingReaderType::Pointer trainingReader = TrainingReaderType::New(); EstimatorType::Pointer svmEstimator = EstimatorType::New(); - inputReader->SetFileName( inputImageFileName ); - trainingReader->SetFileName( trainingImageFileName ); + inputReader->SetFileName(inputImageFileName); + trainingReader->SetFileName(trainingImageFileName); inputReader->Update(); trainingReader->Update(); - svmEstimator->SetInputImage( inputReader->GetOutput() ); - svmEstimator->SetTrainingImage( trainingReader->GetOutput() ); + svmEstimator->SetInputImage(inputReader->GetOutput()); + svmEstimator->SetTrainingImage(trainingReader->GetOutput()); svmEstimator->SetSVMType(ONE_CLASS); svmEstimator->Update(); - otbGenericMsgDebugMacro(<<"Saving model"); + otbGenericMsgDebugMacro(<< "Saving model"); svmEstimator->GetModel()->SaveModel(outputModelFileName); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx b/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx index a7f61c9c06..10ccc3cfb4 100644 --- a/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx +++ b/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include "otbImage.h" #include "otbVectorImage.h" @@ -32,54 +31,51 @@ #include "otbSVMImageModelEstimator.h" #include "otbSVMKernels.h" - #include "otbImageFileReader.h" -int otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest( int argc, char* argv[] ) +int otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest(int argc, char* argv[]) { const char* inputImageFileName = argv[1]; const char* trainingImageFileName = argv[2]; const char* outputModelFileName = argv[3]; - typedef double InputPixelType; - const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::Image< int, Dimension > TrainingImageType; - typedef std::vector<double> VectorType; - typedef otb::SVMImageModelEstimator< InputImageType, - TrainingImageType > EstimatorType; - typedef otb::ImageFileReader< InputImageType > InputReaderType; - typedef otb::ImageFileReader< TrainingImageType > TrainingReaderType; + typedef double InputPixelType; + const unsigned int Dimension = 2; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::Image<int, Dimension> TrainingImageType; + typedef std::vector<double> VectorType; + typedef otb::SVMImageModelEstimator<InputImageType, + TrainingImageType> EstimatorType; + typedef otb::ImageFileReader<InputImageType> InputReaderType; + typedef otb::ImageFileReader<TrainingImageType> TrainingReaderType; InputReaderType::Pointer inputReader = InputReaderType::New(); TrainingReaderType::Pointer trainingReader = TrainingReaderType::New(); EstimatorType::Pointer svmEstimator = EstimatorType::New(); - inputReader->SetFileName( inputImageFileName ); - trainingReader->SetFileName( trainingImageFileName ); + inputReader->SetFileName(inputImageFileName); + trainingReader->SetFileName(trainingImageFileName); inputReader->Update(); trainingReader->Update(); - svmEstimator->SetInputImage( inputReader->GetOutput() ); - svmEstimator->SetTrainingImage( trainingReader->GetOutput() ); + svmEstimator->SetInputImage(inputReader->GetOutput()); + svmEstimator->SetTrainingImage(trainingReader->GetOutput()); svmEstimator->SetSVMType(ONE_CLASS); otb::InverseCosSAMKernelFunctor myKernel; - myKernel.SetValue( "Coef", 1.0 ); + myKernel.SetValue("Coef", 1.0); myKernel.Update(); - svmEstimator->SetKernelFunctor( &myKernel ); - svmEstimator->SetKernelType( GENERIC ); - + svmEstimator->SetKernelFunctor(&myKernel); + svmEstimator->SetKernelType(GENERIC); svmEstimator->Update(); - otbGenericMsgDebugMacro(<<"Saving model"); + otbGenericMsgDebugMacro(<< "Saving model"); svmEstimator->GetModel()->SaveModel(outputModelFileName); - typedef otb::SVMImageClassificationFilter<InputImageType, - TrainingImageType> ClassifierType; + TrainingImageType> ClassifierType; ClassifierType::Pointer classifier = ClassifierType::New(); @@ -89,5 +85,3 @@ int otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest( int argc, return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx b/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx index a7b3162fd3..4342e467b9 100644 --- a/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx +++ b/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include "otbImage.h" #include "otbVectorImage.h" @@ -31,53 +30,48 @@ #include "otbSVMImageModelEstimator.h" #include "otbSVMKernels.h" - #include "otbImageFileReader.h" -int otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest( int argc, char* argv[] ) +int otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest(int argc, char* argv[]) { const char* inputImageFileName = argv[1]; const char* trainingImageFileName = argv[2]; const char* outputModelFileName = argv[3]; - typedef double InputPixelType; - const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::Image< int, Dimension > TrainingImageType; - typedef std::vector<double> VectorType; - typedef otb::SVMImageModelEstimator< InputImageType, - TrainingImageType > EstimatorType; - typedef otb::ImageFileReader< InputImageType > InputReaderType; - typedef otb::ImageFileReader< TrainingImageType > TrainingReaderType; + typedef double InputPixelType; + const unsigned int Dimension = 2; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::Image<int, Dimension> TrainingImageType; + typedef std::vector<double> VectorType; + typedef otb::SVMImageModelEstimator<InputImageType, + TrainingImageType> EstimatorType; + typedef otb::ImageFileReader<InputImageType> InputReaderType; + typedef otb::ImageFileReader<TrainingImageType> TrainingReaderType; InputReaderType::Pointer inputReader = InputReaderType::New(); TrainingReaderType::Pointer trainingReader = TrainingReaderType::New(); EstimatorType::Pointer svmEstimator = EstimatorType::New(); - inputReader->SetFileName( inputImageFileName ); - trainingReader->SetFileName( trainingImageFileName ); + inputReader->SetFileName(inputImageFileName); + trainingReader->SetFileName(trainingImageFileName); inputReader->Update(); trainingReader->Update(); - svmEstimator->SetInputImage( inputReader->GetOutput() ); - svmEstimator->SetTrainingImage( trainingReader->GetOutput() ); + svmEstimator->SetInputImage(inputReader->GetOutput()); + svmEstimator->SetTrainingImage(trainingReader->GetOutput()); svmEstimator->SetSVMType(ONE_CLASS); otb::InverseCosSAMKernelFunctor myKernel; - myKernel.SetValue( "Coef", 1.0 ); + myKernel.SetValue("Coef", 1.0); myKernel.Update(); - svmEstimator->SetKernelFunctor( &myKernel ); - svmEstimator->SetKernelType( GENERIC ); - + svmEstimator->SetKernelFunctor(&myKernel); + svmEstimator->SetKernelType(GENERIC); svmEstimator->Update(); - otbGenericMsgDebugMacro(<<"Saving model"); + otbGenericMsgDebugMacro(<< "Saving model"); svmEstimator->GetModel()->SaveModel(outputModelFileName); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelAccessor.cxx b/Testing/Code/Learning/otbSVMModelAccessor.cxx index 080f404293..68a6843592 100644 --- a/Testing/Code/Learning/otbSVMModelAccessor.cxx +++ b/Testing/Code/Learning/otbSVMModelAccessor.cxx @@ -27,86 +27,81 @@ #include "otbSVMModel.h" - -int otbSVMModelAccessor( int argc, char* argv[] ) +int otbSVMModelAccessor(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; + const unsigned int Dimension = 2; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer ptrModel = ModelType::New(); ptrModel->LoadModel(argv[1]); - // ototo std::ofstream f; - unsigned int nbClass = ptrModel->GetNumberOfClasses(); - unsigned int nbSupportVector = ptrModel->GetNumberOfSupportVectors(); + unsigned int nbClass = ptrModel->GetNumberOfClasses(); + unsigned int nbSupportVector = ptrModel->GetNumberOfSupportVectors(); f.open(argv[2]); - f << "Test methods of SVMModel class:"<<std::endl; - f << " - GetNumberOfClasses() "<< nbClass<<std::endl; - f << " - GetNumberOfHyperplane() "<< ptrModel->GetNumberOfHyperplane()<<std::endl; - f << " - GetNumberOfSupportVectors() "<< nbSupportVector<<std::endl; + f << "Test methods of SVMModel class:" << std::endl; + f << " - GetNumberOfClasses() " << nbClass << std::endl; + f << " - GetNumberOfHyperplane() " << ptrModel->GetNumberOfHyperplane() << std::endl; + f << " - GetNumberOfSupportVectors() " << nbSupportVector << std::endl; - - f << " - GetSupportVectors() [nb support vector][]"<<std::endl; + f << " - GetSupportVectors() [nb support vector][]" << std::endl; svm_node ** SVs = ptrModel->GetSupportVectors(); - if ( SVs == NULL ) - { - itkGenericExceptionMacro(<<"SVs NULL"); - } - for (unsigned int i=0;i<nbSupportVector;i++) - { - if ( SVs[i] == NULL ) itkGenericExceptionMacro(<<"SVs "<<i<<" NULL"); + if (SVs == NULL) + { + itkGenericExceptionMacro(<< "SVs NULL"); + } + for (unsigned int i = 0; i < nbSupportVector; i++) + { + if (SVs[i] == NULL) itkGenericExceptionMacro(<< "SVs " << i << " NULL"); f << std::endl; - f << " SV["<<i<<"]:"; + f << " SV[" << i << "]:"; const svm_node *p = SVs[i]; while (p->index != -1) - { - f << " ["<<p->index << ";"<<p->value<<"] "; + { + f << " [" << p->index << ";" << p->value << "] "; p++; - } + } f << std::endl; - } - - f << " - GetRho() [nr_class*(nr_class-1)/2]"<<std::endl; - unsigned int taille = nbClass*(nbClass-1)/2; - double * rhos = ptrModel->GetRho(); - if ( rhos == NULL ) - { - itkGenericExceptionMacro(<<"rhos NULL"); - } + } + + f << " - GetRho() [nr_class*(nr_class-1)/2]" << std::endl; + unsigned int taille = nbClass * (nbClass - 1) / 2; + double * rhos = ptrModel->GetRho(); + if (rhos == NULL) + { + itkGenericExceptionMacro(<< "rhos NULL"); + } f << " "; - for (unsigned int i=0;i<taille;i++) - { + for (unsigned int i = 0; i < taille; i++) + { f << " " << rhos[i]; - } - + } f << std::endl; - f << " - GetAlpha() [nb class-1][nb support vector]"<<std::endl; + f << " - GetAlpha() [nb class-1][nb support vector]" << std::endl; double ** alphas = ptrModel->GetAlpha(); - if ( alphas == NULL ) - { - itkGenericExceptionMacro(<<"alphas NULL"); - } - for (unsigned int i=0;i<nbClass-1;i++) - { - if ( alphas[i] == NULL ) itkGenericExceptionMacro(<<"alphas "<<i<<" NULL"); - f << " "; - for (unsigned int j=0;j<nbSupportVector;j++) + if (alphas == NULL) { + itkGenericExceptionMacro(<< "alphas NULL"); + } + for (unsigned int i = 0; i < nbClass - 1; i++) + { + if (alphas[i] == NULL) itkGenericExceptionMacro(<< "alphas " << i << " NULL"); + f << " "; + for (unsigned int j = 0; j < nbSupportVector; j++) + { f << " " << alphas[i][j]; + } } - } f << std::endl; // f << " - Evaluate() (double) -> "<<ptrModel->Evaluate()<<std::endl; @@ -119,11 +114,8 @@ int otbSVMModelAccessor( int argc, char* argv[] ) // { // f << " "<<_evaluateHyperplaneDistance[i]<<std::endl; // } - f << "end"<<std::endl; + f << "end" << std::endl; f.close(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelCopyComposedKernelTest.cxx b/Testing/Code/Learning/otbSVMModelCopyComposedKernelTest.cxx index 53c80c401a..83ee260244 100644 --- a/Testing/Code/Learning/otbSVMModelCopyComposedKernelTest.cxx +++ b/Testing/Code/Learning/otbSVMModelCopyComposedKernelTest.cxx @@ -25,13 +25,12 @@ #include "otbSVMKernels.h" #include "otbSVMModel.h" - -int otbSVMModelCopyComposedKernelTest( int argc, char* argv[] ) +int otbSVMModelCopyComposedKernelTest(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer svmModel = ModelType::New(); svmModel->LoadModel(argv[1]); @@ -42,5 +41,3 @@ int otbSVMModelCopyComposedKernelTest( int argc, char* argv[] ) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelCopyGenericKernelTest.cxx b/Testing/Code/Learning/otbSVMModelCopyGenericKernelTest.cxx index 4545017b56..c72b41096b 100644 --- a/Testing/Code/Learning/otbSVMModelCopyGenericKernelTest.cxx +++ b/Testing/Code/Learning/otbSVMModelCopyGenericKernelTest.cxx @@ -25,16 +25,15 @@ #include "otbSVMKernels.h" #include "otbSVMModel.h" - -int otbSVMModelCopyGenericKernelTest( int argc, char* argv[] ) +int otbSVMModelCopyGenericKernelTest(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; // Create the model to be copied - ModelType::Pointer svmModel = ModelType::New(); + ModelType::Pointer svmModel = ModelType::New(); otb::RBFKernelFunctor lFunctor; svmModel->SetKernelFunctor(&lFunctor); svmModel->LoadModel(argv[1]); @@ -46,5 +45,3 @@ int otbSVMModelCopyGenericKernelTest( int argc, char* argv[] ) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelCopyTest.cxx b/Testing/Code/Learning/otbSVMModelCopyTest.cxx index bdeab7ca72..c2fbd58b1c 100644 --- a/Testing/Code/Learning/otbSVMModelCopyTest.cxx +++ b/Testing/Code/Learning/otbSVMModelCopyTest.cxx @@ -26,15 +26,14 @@ #include "otbSVMModel.h" - -int otbSVMModelCopyTest( int argc, char* argv[] ) +int otbSVMModelCopyTest(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer svmModel = ModelType::New(); @@ -43,8 +42,5 @@ int otbSVMModelCopyTest( int argc, char* argv[] ) ModelType::Pointer svmModelCopy = svmModel->GetCopy(); svmModelCopy->SaveModel(argv[2]); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelGenericKernelLoadSave.cxx b/Testing/Code/Learning/otbSVMModelGenericKernelLoadSave.cxx index 90be0cfe4f..552d07c477 100644 --- a/Testing/Code/Learning/otbSVMModelGenericKernelLoadSave.cxx +++ b/Testing/Code/Learning/otbSVMModelGenericKernelLoadSave.cxx @@ -32,26 +32,26 @@ namespace otb class LinearKernelFunctor : public GenericKernelFunctorBase { public: - LinearKernelFunctor(): GenericKernelFunctorBase() {}; - virtual ~LinearKernelFunctor() {}; + LinearKernelFunctor() : GenericKernelFunctorBase() {} + virtual ~LinearKernelFunctor() {} - virtual double operator()(const svm_node *x, const svm_node *y, const svm_parameter& param)const + virtual double operator ()(const svm_node *x, const svm_node *y, const svm_parameter& param) const { - return this->dot(x,y); + return this->dot(x, y); } }; } -int otbSVMModelGenericKernelLoadSave( int argc, char* argv[] ) +int otbSVMModelGenericKernelLoadSave(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer svmModel = ModelType::New(); @@ -62,8 +62,5 @@ int otbSVMModelGenericKernelLoadSave( int argc, char* argv[] ) svmModel->LoadModel(argv[1]); svmModel->SaveModel(argv[2]); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelGenericKernelsTest.cxx b/Testing/Code/Learning/otbSVMModelGenericKernelsTest.cxx index b0f669b56a..711b25d4b9 100644 --- a/Testing/Code/Learning/otbSVMModelGenericKernelsTest.cxx +++ b/Testing/Code/Learning/otbSVMModelGenericKernelsTest.cxx @@ -27,13 +27,12 @@ #include "otbSVMModel.h" #include "otbSVMKernels.h" - -int otbSVMModelGenericKernelsTest( int argc, char* argv[] ) +int otbSVMModelGenericKernelsTest(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer svmModel = ModelType::New(); @@ -67,17 +66,17 @@ int otbSVMModelGenericKernelsTest( int argc, char* argv[] ) model->param.kernel_type = 5; model->nr_class = 2; model->l = 5; - model->sv_coef = new double*[model->nr_class-1]; + model->sv_coef = new double*[model->nr_class - 1]; - for (int i=0; i<model->nr_class-1; i++) + for (int i = 0; i < model->nr_class - 1; i++) model->sv_coef[i] = new double[model->l]; - model->SV = new svm_node*[model->l]; - for (int n = 0; n<model->l; ++n) - { - model->SV[n]=new svm_node[1]; + model->SV = new svm_node *[model->l]; + for (int n = 0; n < model->l; ++n) + { + model->SV[n] = new svm_node[1]; model->SV[n]->index = -1; model->SV[n]->value = 0.; - } + } model->sv_coef[0][0] = 0.125641; model->sv_coef[0][1] = 1; @@ -97,11 +96,11 @@ int otbSVMModelGenericKernelsTest( int argc, char* argv[] ) model->param.degree = 2; struct svm_node *p = new struct svm_node[20]; - for (unsigned int n = 0;n<20;++n) - { + for (unsigned int n = 0; n < 20; ++n) + { p[n].index = -1; p[n].value = 0.; - } + } model->SV[0] = &p[0]; model->SV[1] = &p[4]; model->SV[2] = &p[8]; @@ -192,5 +191,3 @@ int otbSVMModelGenericKernelsTest( int argc, char* argv[] ) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelLoad.cxx b/Testing/Code/Learning/otbSVMModelLoad.cxx index ddfaba27bd..9137d35321 100644 --- a/Testing/Code/Learning/otbSVMModelLoad.cxx +++ b/Testing/Code/Learning/otbSVMModelLoad.cxx @@ -26,24 +26,19 @@ #include "otbSVMModel.h" - -int otbSVMModelLoad( int argc, char* argv[] ) +int otbSVMModelLoad(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; + const unsigned int Dimension = 2; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer svmModel = ModelType::New(); svmModel->LoadModel(argv[1]); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelLoadSave.cxx b/Testing/Code/Learning/otbSVMModelLoadSave.cxx index 5961bf95f1..54ebf1d330 100644 --- a/Testing/Code/Learning/otbSVMModelLoadSave.cxx +++ b/Testing/Code/Learning/otbSVMModelLoadSave.cxx @@ -26,25 +26,20 @@ #include "otbSVMModel.h" - -int otbSVMModelLoadSave( int argc, char* argv[] ) +int otbSVMModelLoadSave(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; + const unsigned int Dimension = 2; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer svmModel = ModelType::New(); svmModel->LoadModel(argv[1]); svmModel->SaveModel(argv[2]); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMModelNew.cxx b/Testing/Code/Learning/otbSVMModelNew.cxx index 8fe60d851d..69b01f6015 100644 --- a/Testing/Code/Learning/otbSVMModelNew.cxx +++ b/Testing/Code/Learning/otbSVMModelNew.cxx @@ -26,21 +26,16 @@ #include "otbSVMModel.h" - -int otbSVMModelNew( int argc, char* argv[] ) +int otbSVMModelNew(int argc, char* argv[]) { - typedef unsigned char InputPixelType; - typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType; + typedef unsigned char InputPixelType; + typedef unsigned char LabelPixelType; + const unsigned int Dimension = 2; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::SVMModel<InputPixelType, LabelPixelType> ModelType; ModelType::Pointer svmModel = ModelType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMPointSetModelEstimatorNew.cxx b/Testing/Code/Learning/otbSVMPointSetModelEstimatorNew.cxx index 29b323ae81..2e7d57b7a0 100644 --- a/Testing/Code/Learning/otbSVMPointSetModelEstimatorNew.cxx +++ b/Testing/Code/Learning/otbSVMPointSetModelEstimatorNew.cxx @@ -20,30 +20,24 @@ #pragma warning ( disable : 4786 ) #endif - #include "itkExceptionObject.h" #include "itkPointSet.h" #include <iostream> #include "otbSVMPointSetModelEstimator.h" - -int otbSVMPointSetModelEstimatorNew( int argc, char* argv[] ) +int otbSVMPointSetModelEstimatorNew(int argc, char* argv[]) { - typedef std::vector<double> InputPixelType; - typedef double LabelPixelType; - const unsigned int Dimension = 2; - - typedef itk::PointSet< InputPixelType, Dimension > MeasurePointSetType; - typedef itk::PointSet< LabelPixelType, Dimension > LabelPointSetType; - typedef otb::SVMPointSetModelEstimator< MeasurePointSetType, - LabelPointSetType > EstimatorType; + typedef std::vector<double> InputPixelType; + typedef double LabelPixelType; + const unsigned int Dimension = 2; + typedef itk::PointSet<InputPixelType, Dimension> MeasurePointSetType; + typedef itk::PointSet<LabelPixelType, Dimension> LabelPointSetType; + typedef otb::SVMPointSetModelEstimator<MeasurePointSetType, + LabelPointSetType> EstimatorType; EstimatorType::Pointer estimator = EstimatorType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Learning/otbSVMPointSetModelEstimatorTrain.cxx b/Testing/Code/Learning/otbSVMPointSetModelEstimatorTrain.cxx index 37cdd00e87..067c1f6732 100644 --- a/Testing/Code/Learning/otbSVMPointSetModelEstimatorTrain.cxx +++ b/Testing/Code/Learning/otbSVMPointSetModelEstimatorTrain.cxx @@ -26,32 +26,30 @@ #include "otbSVMPointSetModelEstimator.h" - -int otbSVMPointSetModelEstimatorTrain( int argc, char* argv[] ) +int otbSVMPointSetModelEstimatorTrain(int argc, char* argv[]) { const char* outputModelFileName = argv[1]; typedef std::vector<double> InputPixelType; typedef double LabelPixelType; - const unsigned int Dimension = 2; - - typedef itk::PointSet< InputPixelType, Dimension > MeasurePointSetType; - typedef itk::PointSet< LabelPixelType, Dimension > LabelPointSetType; - typedef MeasurePointSetType::PointType MeasurePointType; - typedef LabelPointSetType::PointType LabelPointType; - typedef MeasurePointSetType::PointsContainer MeasurePointsContainer; - typedef LabelPointSetType::PointsContainer LabelPointsContainer; + const unsigned int Dimension = 2; + typedef itk::PointSet<InputPixelType, Dimension> MeasurePointSetType; + typedef itk::PointSet<LabelPixelType, Dimension> LabelPointSetType; + typedef MeasurePointSetType::PointType MeasurePointType; + typedef LabelPointSetType::PointType LabelPointType; + typedef MeasurePointSetType::PointsContainer MeasurePointsContainer; + typedef LabelPointSetType::PointsContainer LabelPointsContainer; MeasurePointSetType::Pointer mPSet = MeasurePointSetType::New(); LabelPointSetType::Pointer lPSet = LabelPointSetType::New(); MeasurePointsContainer::Pointer mCont = MeasurePointsContainer::New(); LabelPointsContainer::Pointer lCont = LabelPointsContainer::New(); - for (unsigned int pointId = 0; pointId<20; pointId++) - { + for (unsigned int pointId = 0; pointId < 20; pointId++) + { MeasurePointType mP; - LabelPointType lP; + LabelPointType lP; mP[0] = pointId; mP[1] = pointId; @@ -60,34 +58,31 @@ int otbSVMPointSetModelEstimatorTrain( int argc, char* argv[] ) lP[1] = pointId; InputPixelType measure; - measure.push_back(double(2.0*pointId)); + measure.push_back(double(2.0 * pointId)); measure.push_back(double(-10)); - LabelPixelType label = static_cast<LabelPixelType>( (measure[0]+measure[1])>0 ); //2x-10>0 + LabelPixelType label = static_cast<LabelPixelType>((measure[0] + measure[1]) > 0); //2x-10>0 - mCont->InsertElement( pointId , mP ); - mPSet->SetPointData( pointId, measure ); + mCont->InsertElement(pointId, mP); + mPSet->SetPointData(pointId, measure); - lCont->InsertElement( pointId , lP ); - lPSet->SetPointData( pointId, label ); - } + lCont->InsertElement(pointId, lP); + lPSet->SetPointData(pointId, label); + } - mPSet->SetPoints( mCont ); - lPSet->SetPoints( lCont ); + mPSet->SetPoints(mCont); + lPSet->SetPoints(lCont); - typedef otb::SVMPointSetModelEstimator< MeasurePointSetType, LabelPointSetType > EstimatorType; + typedef otb::SVMPointSetModelEstimator<MeasurePointSetType, LabelPointSetType> EstimatorType; EstimatorType::Pointer estimator = EstimatorType::New(); - estimator->SetInputPointSet( mPSet ); - estimator->SetTrainingPointSet( lPSet ); + estimator->SetInputPointSet(mPSet); + estimator->SetTrainingPointSet(lPSet); estimator->ParametersOptimizationOff(); estimator->Update(); estimator->GetModel()->SaveModel(outputModelFileName); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Markov/otbMRFEnergyEdgeFidelity.cxx b/Testing/Code/Markov/otbMRFEnergyEdgeFidelity.cxx index 8f34ac667f..cc6ea4fc12 100644 --- a/Testing/Code/Markov/otbMRFEnergyEdgeFidelity.cxx +++ b/Testing/Code/Markov/otbMRFEnergyEdgeFidelity.cxx @@ -27,21 +27,20 @@ int otbMRFEnergyEdgeFidelity(int argc, char * argv[]) { const char * outputFile = argv[1]; - typedef double PixelTypeInput; - typedef int PixelTypeLabel; - typedef otb::Image<PixelTypeInput, 2> ImageType; - typedef otb::Image<PixelTypeLabel, 2> LabelType; - typedef otb::MRFEnergyEdgeFidelity< ImageType, LabelType> MRFEnergyType; + typedef double PixelTypeInput; + typedef int PixelTypeLabel; + typedef otb::Image<PixelTypeInput, 2> ImageType; + typedef otb::Image<PixelTypeLabel, 2> LabelType; + typedef otb::MRFEnergyEdgeFidelity<ImageType, LabelType> MRFEnergyType; MRFEnergyType::Pointer object = MRFEnergyType::New(); std::ofstream file; file.open(outputFile); - file<<"GetSimngleValue(10, 50): "<< object->GetSingleValue(10, 50)<<std::endl; + file << "GetSimngleValue(10, 50): " << object->GetSingleValue(10, 50) << std::endl; file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFEnergyEdgeFidelityNew.cxx b/Testing/Code/Markov/otbMRFEnergyEdgeFidelityNew.cxx index cdff9dad25..fb2a6a113d 100644 --- a/Testing/Code/Markov/otbMRFEnergyEdgeFidelityNew.cxx +++ b/Testing/Code/Markov/otbMRFEnergyEdgeFidelityNew.cxx @@ -22,19 +22,16 @@ #include "otbMRFEnergyEdgeFidelity.h" #include "otbImage.h" - int otbMRFEnergyEdgeFidelityNew(int argc, char * argv[]) { typedef double PixelType; typedef int PixelType2; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::Image<PixelType2, 2> ImageType2; - typedef otb::MRFEnergyEdgeFidelity< ImageType, ImageType > MRFEnergyType; - - MRFEnergyType::Pointer object = MRFEnergyType::New(); + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::Image<PixelType2, 2> ImageType2; + typedef otb::MRFEnergyEdgeFidelity<ImageType, ImageType> MRFEnergyType; + MRFEnergyType::Pointer object = MRFEnergyType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFEnergyGaussian.cxx b/Testing/Code/Markov/otbMRFEnergyGaussian.cxx index 034f251004..ff1ad54668 100644 --- a/Testing/Code/Markov/otbMRFEnergyGaussian.cxx +++ b/Testing/Code/Markov/otbMRFEnergyGaussian.cxx @@ -25,12 +25,12 @@ int otbMRFEnergyGaussian(int argc, char * argv[]) { - typedef double PixelType; - typedef int PixelType2; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::Image<PixelType2, 2> LabelType; + typedef double PixelType; + typedef int PixelType2; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::Image<PixelType2, 2> LabelType; - typedef otb::MRFEnergyGaussian< ImageType, LabelType> MRFEnergyGaussianType; + typedef otb::MRFEnergyGaussian<ImageType, LabelType> MRFEnergyGaussianType; typedef MRFEnergyGaussianType::InputImagePixelType InputImagePixelType; typedef MRFEnergyGaussianType::LabelledImagePixelType LabelledImagePixelType; @@ -39,26 +39,24 @@ int otbMRFEnergyGaussian(int argc, char * argv[]) InputImagePixelType inPix = 10; LabelledImagePixelType inLab = 5; - if ( object->GetSingleValue(inPix, inLab) != 25 ) - { + if (object->GetSingleValue(inPix, inLab) != 25) + { return EXIT_FAILURE; - } + } inPix = 5; inLab = 10; - if ( object->GetSingleValue(inPix, inLab) != 25 ) - { + if (object->GetSingleValue(inPix, inLab) != 25) + { return EXIT_FAILURE; - } + } inPix = 0; inLab = 0; - if ( object->GetSingleValue(inPix, inLab) != 0 ) - { + if (object->GetSingleValue(inPix, inLab) != 0) + { return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFEnergyGaussianClassification.cxx b/Testing/Code/Markov/otbMRFEnergyGaussianClassification.cxx index df74d445e0..c8bee61513 100644 --- a/Testing/Code/Markov/otbMRFEnergyGaussianClassification.cxx +++ b/Testing/Code/Markov/otbMRFEnergyGaussianClassification.cxx @@ -23,15 +23,14 @@ #include "otbImage.h" #include <fstream> - int otbMRFEnergyGaussianClassification(int argc, char * argv[]) { const char * outputFile = argv[1]; - typedef double PixelTypeInput; - typedef int PixelTypeLabel; - typedef otb::Image<PixelTypeInput, 2> ImageType; - typedef otb::Image<PixelTypeLabel, 2> LabelType; + typedef double PixelTypeInput; + typedef int PixelTypeLabel; + typedef otb::Image<PixelTypeInput, 2> ImageType; + typedef otb::Image<PixelTypeLabel, 2> LabelType; typedef otb::MRFEnergyGaussianClassification<ImageType, LabelType> MRFGaussianType; @@ -49,12 +48,11 @@ int otbMRFEnergyGaussianClassification(int argc, char * argv[]) std::ofstream file; file.open(outputFile); - file<<std::endl; - file<<"Number of paramters: "<<classif->GetNumberOfParameters()<<std::endl; - file<<"GetSingleValue(10, 1): "<<classif->GetSingleValue(10, 2)<<std::endl; + file << std::endl; + file << "Number of paramters: " << classif->GetNumberOfParameters() << std::endl; + file << "GetSingleValue(10, 1): " << classif->GetSingleValue(10, 2) << std::endl; file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFEnergyGaussianClassificationNew.cxx b/Testing/Code/Markov/otbMRFEnergyGaussianClassificationNew.cxx index 3cd2ad989e..70148a1744 100644 --- a/Testing/Code/Markov/otbMRFEnergyGaussianClassificationNew.cxx +++ b/Testing/Code/Markov/otbMRFEnergyGaussianClassificationNew.cxx @@ -22,15 +22,13 @@ #include "otbMRFEnergyGaussianClassification.h" #include "otbImage.h" - int otbMRFEnergyGaussianClassificationNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; typedef otb::MRFEnergyGaussianClassification<ImageType, ImageType> MRFGaussianType; MRFGaussianType::Pointer object = MRFGaussianType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx b/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx index 10612183cb..d23b636d7a 100644 --- a/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx +++ b/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx @@ -22,15 +22,13 @@ #include "otbMRFEnergyGaussian.h" #include "otbImage.h" - int otbMRFEnergyGaussianNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::MRFEnergyGaussian< ImageType, ImageType> MRFEnergyGaussianType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::MRFEnergyGaussian<ImageType, ImageType> MRFEnergyGaussianType; MRFEnergyGaussianType::Pointer object = MRFEnergyGaussianType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFEnergyPotts.cxx b/Testing/Code/Markov/otbMRFEnergyPotts.cxx index 36caeb734c..08ad7518e9 100644 --- a/Testing/Code/Markov/otbMRFEnergyPotts.cxx +++ b/Testing/Code/Markov/otbMRFEnergyPotts.cxx @@ -27,12 +27,12 @@ int otbMRFEnergyPotts(int argc, char * argv[]) { const char * outputFile = argv[1]; - typedef double PixelType; - typedef int PixelType2; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::Image<PixelType2, 2> LabelType; + typedef double PixelType; + typedef int PixelType2; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::Image<PixelType2, 2> LabelType; - typedef otb::MRFEnergyPotts< ImageType, LabelType> MRFEnergyPottsType; + typedef otb::MRFEnergyPotts<ImageType, LabelType> MRFEnergyPottsType; typedef MRFEnergyPottsType::InputImagePixelType InputImagePixelType; typedef MRFEnergyPottsType::LabelledImagePixelType LabelledImagePixelType; @@ -44,13 +44,15 @@ int otbMRFEnergyPotts(int argc, char * argv[]) std::ofstream file; file.open(outputFile); - file<<"GetValue(const InputImagePixelType = 10, const LabelledImagePixelType = 5): "<< object->GetValue(inPix, inLab)<<std::endl; + file << "GetValue(const InputImagePixelType = 10, const LabelledImagePixelType = 5): " << object->GetValue(inPix, + inLab) << + std::endl; inPix = 5; - file<<"GetValue(const InputImagePixelType = 5, const LabelledImagePixelType = 5) : "<< object->GetValue(inPix, inLab)<<std::endl; + file << "GetValue(const InputImagePixelType = 5, const LabelledImagePixelType = 5) : " << object->GetValue(inPix, + inLab) << + std::endl; file.close(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFEnergyPottsNew.cxx b/Testing/Code/Markov/otbMRFEnergyPottsNew.cxx index 96c8652262..1031b39d6d 100644 --- a/Testing/Code/Markov/otbMRFEnergyPottsNew.cxx +++ b/Testing/Code/Markov/otbMRFEnergyPottsNew.cxx @@ -22,15 +22,13 @@ #include "otbMRFEnergyPotts.h" #include "otbImage.h" - int otbMRFEnergyPottsNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::MRFEnergyPotts< ImageType, ImageType> MRFEnergyPottsType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::MRFEnergyPotts<ImageType, ImageType> MRFEnergyPottsType; MRFEnergyPottsType::Pointer object = MRFEnergyPottsType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFOptimizerICM.cxx b/Testing/Code/Markov/otbMRFOptimizerICM.cxx index f9a1c62a3b..165f26c2ea 100644 --- a/Testing/Code/Markov/otbMRFOptimizerICM.cxx +++ b/Testing/Code/Markov/otbMRFOptimizerICM.cxx @@ -28,12 +28,10 @@ int otbMRFOptimizerICM(int argc, char * argv[]) MRFOptimizerICMType::Pointer object = MRFOptimizerICMType::New(); - if ( object->Compute(-1) != true || object->Compute(1) != false ) - { + if (object->Compute(-1) != true || object->Compute(1) != false) + { return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFOptimizerICMNew.cxx b/Testing/Code/Markov/otbMRFOptimizerICMNew.cxx index 5152771f2d..f08d8457a1 100644 --- a/Testing/Code/Markov/otbMRFOptimizerICMNew.cxx +++ b/Testing/Code/Markov/otbMRFOptimizerICMNew.cxx @@ -24,10 +24,9 @@ int otbMRFOptimizerICMNew(int argc, char * argv[]) { - typedef otb::MRFOptimizerICM MRFOptimizerType; + typedef otb::MRFOptimizerICM MRFOptimizerType; MRFOptimizerType::Pointer object = MRFOptimizerType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFOptimizerMetropolis.cxx b/Testing/Code/Markov/otbMRFOptimizerMetropolis.cxx index 2c47b89d1e..a1fdb778cb 100644 --- a/Testing/Code/Markov/otbMRFOptimizerMetropolis.cxx +++ b/Testing/Code/Markov/otbMRFOptimizerMetropolis.cxx @@ -34,16 +34,15 @@ int otbMRFOptimizerMetropolis(int argc, char * argv[]) MRFOptimizerType::ParametersType param(1); param.Fill(10.); object->SetParameters(param); - object->InitializeSeed(0);// USED TO OVERPASS RANDOM CALCULATION + object->InitializeSeed(0); // USED TO OVERPASS RANDOM CALCULATION std::ofstream file; file.open(outputFile); - file<<"Compute(0) : "<<object->Compute(0.)<<std::endl; - file<<"Compute(-1.) : "<<object->Compute(-1.)<<std::endl; + file << "Compute(0) : " << object->Compute(0.) << std::endl; + file << "Compute(-1.) : " << object->Compute(-1.) << std::endl; file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFOptimizerMetropolisNew.cxx b/Testing/Code/Markov/otbMRFOptimizerMetropolisNew.cxx index 264e13651f..61b36cf207 100644 --- a/Testing/Code/Markov/otbMRFOptimizerMetropolisNew.cxx +++ b/Testing/Code/Markov/otbMRFOptimizerMetropolisNew.cxx @@ -30,4 +30,3 @@ int otbMRFOptimizerMetropolisNew(int argc, char * argv[]) return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFSamplerMAP.cxx b/Testing/Code/Markov/otbMRFSamplerMAP.cxx index d626e72b99..1edbe1951d 100644 --- a/Testing/Code/Markov/otbMRFSamplerMAP.cxx +++ b/Testing/Code/Markov/otbMRFSamplerMAP.cxx @@ -25,7 +25,6 @@ #include "otbMRFEnergyPotts.h" #include <fstream> - int otbMRFSamplerMAP(int argc, char * argv[]) { const char * inputImage = argv[1]; @@ -36,16 +35,15 @@ int otbMRFSamplerMAP(int argc, char * argv[]) typedef int PixelTypeLabel; typedef otb::Image<PixelTypeInput, 2> ImageType; typedef otb::Image<PixelTypeLabel, 2> LabelType; - typedef otb::ImageFileReader< ImageType > ReaderInputType; - typedef otb::ImageFileReader< LabelType > ReaderLabelType; - typedef otb::MRFSamplerMAP< ImageType, LabelType> MRFSamplerMAPType; + typedef otb::ImageFileReader<ImageType> ReaderInputType; + typedef otb::ImageFileReader<LabelType> ReaderLabelType; + typedef otb::MRFSamplerMAP<ImageType, LabelType> MRFSamplerMAPType; typedef MRFSamplerMAPType::LabelledImageNeighborhoodIterator LabelledNeighborhoodIterator; typedef MRFSamplerMAPType::InputImageNeighborhoodIterator InputNeighborhoodIterator; typedef otb::MRFEnergyPotts <ImageType, LabelType> EnergyFidelityType; typedef otb::MRFEnergyPotts <LabelType, LabelType> EnergyRegularizationType; - MRFSamplerMAPType::Pointer object = MRFSamplerMAPType::New(); EnergyRegularizationType::Pointer energyRegularization = EnergyRegularizationType::New(); EnergyFidelityType::Pointer energyFidelity = EnergyFidelityType::New(); @@ -55,8 +53,8 @@ int otbMRFSamplerMAP(int argc, char * argv[]) object->SetEnergyFidelity(energyFidelity); object->SetEnergyRegularization(energyRegularization); - readerIn->SetFileName( inputImage ); - readerLab->SetFileName( labelImage ); + readerIn->SetFileName(inputImage); + readerLab->SetFileName(labelImage); readerIn->Update(); readerLab->Update(); @@ -66,32 +64,35 @@ int otbMRFSamplerMAP(int argc, char * argv[]) idIn[1] = 50; idLab[0] = 70; idLab[1] = 70; - ImageType::PixelType inPix = readerIn->GetOutput()->GetPixel( idIn ); - LabelType::PixelType inLab = readerLab->GetOutput()->GetPixel( idLab ); + ImageType::PixelType inPix = readerIn->GetOutput()->GetPixel(idIn); + LabelType::PixelType inLab = readerLab->GetOutput()->GetPixel(idLab); InputNeighborhoodIterator::RadiusType radIn; LabelledNeighborhoodIterator::RadiusType radLab; radIn.Fill(3); radLab.Fill(3); - InputNeighborhoodIterator iterIn = InputNeighborhoodIterator( radIn, readerIn->GetOutput(), readerIn->GetOutput()->GetLargestPossibleRegion()); - LabelledNeighborhoodIterator iterLab = LabelledNeighborhoodIterator( radLab, readerLab->GetOutput(), readerLab->GetOutput()->GetLargestPossibleRegion()); + InputNeighborhoodIterator iterIn = InputNeighborhoodIterator(radIn, readerIn->GetOutput(), + readerIn->GetOutput()->GetLargestPossibleRegion()); + LabelledNeighborhoodIterator iterLab = LabelledNeighborhoodIterator(radLab, + readerLab->GetOutput(), + readerLab->GetOutput()->GetLargestPossibleRegion()); std::ofstream file; file.open(outputFile); - file<<"Used pixels: (50, 50) -> "<<inPix<<" , (70, 70) -> "<<inLab<<std::endl; - file<<std::endl; - file<<"Compute(const InputNeighborhoodIterator, const LabelledNeighborhoodIterator) "<<object->Compute(iterIn, iterLab)<<std::endl; + file << "Used pixels: (50, 50) -> " << inPix << " , (70, 70) -> " << inLab << std::endl; + file << std::endl; + file << "Compute(const InputNeighborhoodIterator, const LabelledNeighborhoodIterator) " << object->Compute(iterIn, + iterLab) + << std::endl; // All values (exept m_Value) are null : SingleValue return 0... - file<<"m_EnergyBefore: "<<object->GetEnergyBefore()<<std::endl; - file<<"m_EnergyAfter : "<<object->GetEnergyAfter()<<std::endl; - file<<"m_Value : "<<object->GetValue()<<std::endl; - file<<"m_DeltaEnergy : "<<object->GetDeltaEnergy()<<std::endl; - + file << "m_EnergyBefore: " << object->GetEnergyBefore() << std::endl; + file << "m_EnergyAfter : " << object->GetEnergyAfter() << std::endl; + file << "m_Value : " << object->GetValue() << std::endl; + file << "m_DeltaEnergy : " << object->GetDeltaEnergy() << std::endl; file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFSamplerMAPNew.cxx b/Testing/Code/Markov/otbMRFSamplerMAPNew.cxx index 0f8d873606..f68afd56d2 100644 --- a/Testing/Code/Markov/otbMRFSamplerMAPNew.cxx +++ b/Testing/Code/Markov/otbMRFSamplerMAPNew.cxx @@ -24,15 +24,13 @@ #include "otbMRFSamplerMAP.h" #include "otbImage.h" - int otbMRFSamplerMAPNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::MRFSamplerMAP< ImageType, ImageType> MRFSamplerType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::MRFSamplerMAP<ImageType, ImageType> MRFSamplerType; MRFSamplerType::Pointer object = MRFSamplerType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFSamplerRandom.cxx b/Testing/Code/Markov/otbMRFSamplerRandom.cxx index d435bcb896..811afdf4b0 100644 --- a/Testing/Code/Markov/otbMRFSamplerRandom.cxx +++ b/Testing/Code/Markov/otbMRFSamplerRandom.cxx @@ -25,7 +25,6 @@ #include "otbMRFEnergyPotts.h" #include <fstream> - int otbMRFSamplerRandom(int argc, char * argv[]) { const char * inputImage = argv[1]; @@ -36,14 +35,14 @@ int otbMRFSamplerRandom(int argc, char * argv[]) typedef int PixelTypeLabel; typedef otb::Image<PixelTypeInput, 2> ImageType; typedef otb::Image<PixelTypeLabel, 2> LabelType; - typedef otb::ImageFileReader< ImageType > ReaderInputType; - typedef otb::ImageFileReader< LabelType > ReaderLabelType; - typedef otb::MRFSamplerRandom< ImageType, LabelType> MRFSamplerRandomType; + typedef otb::ImageFileReader<ImageType> ReaderInputType; + typedef otb::ImageFileReader<LabelType> ReaderLabelType; + typedef otb::MRFSamplerRandom<ImageType, LabelType> MRFSamplerRandomType; typedef MRFSamplerRandomType::LabelledImageNeighborhoodIterator LabelledNeighborhoodIterator; typedef MRFSamplerRandomType::InputImageNeighborhoodIterator InputNeighborhoodIterator; - typedef otb::MRFEnergyPotts <ImageType, LabelType> EnergyFidelityType; - typedef otb::MRFEnergyPotts <LabelType, LabelType> EnergyRegularizationType; + typedef otb::MRFEnergyPotts <ImageType, LabelType> EnergyFidelityType; + typedef otb::MRFEnergyPotts <LabelType, LabelType> EnergyRegularizationType; MRFSamplerRandomType::Pointer object = MRFSamplerRandomType::New(); EnergyRegularizationType::Pointer energyRegularization = EnergyRegularizationType::New(); @@ -53,10 +52,10 @@ int otbMRFSamplerRandom(int argc, char * argv[]) object->SetEnergyFidelity(energyFidelity); object->SetEnergyRegularization(energyRegularization); - object->InitializeSeed(0);// USED TO OVERPASS RANDOM CALCULATION + object->InitializeSeed(0); // USED TO OVERPASS RANDOM CALCULATION - readerIn->SetFileName( inputImage ); - readerLab->SetFileName( labelImage ); + readerIn->SetFileName(inputImage); + readerLab->SetFileName(labelImage); readerIn->Update(); readerLab->Update(); @@ -66,32 +65,35 @@ int otbMRFSamplerRandom(int argc, char * argv[]) idIn[1] = 50; idLab[0] = 70; idLab[1] = 70; - ImageType::PixelType inPix = readerIn->GetOutput()->GetPixel( idIn ); - LabelType::PixelType inLab = readerLab->GetOutput()->GetPixel( idLab ); + ImageType::PixelType inPix = readerIn->GetOutput()->GetPixel(idIn); + LabelType::PixelType inLab = readerLab->GetOutput()->GetPixel(idLab); InputNeighborhoodIterator::RadiusType radIn; LabelledNeighborhoodIterator::RadiusType radLab; radIn.Fill(3); radLab.Fill(3); - InputNeighborhoodIterator iterIn = InputNeighborhoodIterator( radIn, readerIn->GetOutput(), readerIn->GetOutput()->GetLargestPossibleRegion()); - LabelledNeighborhoodIterator iterLab = LabelledNeighborhoodIterator( radLab, readerLab->GetOutput(), readerLab->GetOutput()->GetLargestPossibleRegion()); + InputNeighborhoodIterator iterIn = InputNeighborhoodIterator(radIn, readerIn->GetOutput(), + readerIn->GetOutput()->GetLargestPossibleRegion()); + LabelledNeighborhoodIterator iterLab = LabelledNeighborhoodIterator(radLab, + readerLab->GetOutput(), + readerLab->GetOutput()->GetLargestPossibleRegion()); std::ofstream file; file.open(outputFile); - file<<"Used pixels: (50, 50) -> "<<inPix<<" , (70, 70) -> "<<inLab<<std::endl; - file<<std::endl; - file<<"Compute(const InputNeighborhoodIterator, const LabelledNeighborhoodIterator) "<<object->Compute(iterIn, iterLab)<<std::endl; + file << "Used pixels: (50, 50) -> " << inPix << " , (70, 70) -> " << inLab << std::endl; + file << std::endl; + file << "Compute(const InputNeighborhoodIterator, const LabelledNeighborhoodIterator) " << object->Compute(iterIn, + iterLab) + << std::endl; // All values (exept m_Value) are null : SingleValue return 0... - file<<"m_EnergyBefore: "<<object->GetEnergyBefore()<<std::endl; - file<<"m_EnergyAfter : "<<object->GetEnergyAfter()<<std::endl; - file<<"m_Value : "<<object->GetValue()<<std::endl; - file<<"m_DeltaEnergy : "<<object->GetDeltaEnergy()<<std::endl; - + file << "m_EnergyBefore: " << object->GetEnergyBefore() << std::endl; + file << "m_EnergyAfter : " << object->GetEnergyAfter() << std::endl; + file << "m_Value : " << object->GetValue() << std::endl; + file << "m_DeltaEnergy : " << object->GetDeltaEnergy() << std::endl; file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFSamplerRandomMAP.cxx b/Testing/Code/Markov/otbMRFSamplerRandomMAP.cxx index 3c866b532c..fa92eda380 100644 --- a/Testing/Code/Markov/otbMRFSamplerRandomMAP.cxx +++ b/Testing/Code/Markov/otbMRFSamplerRandomMAP.cxx @@ -26,24 +26,22 @@ #include <fstream> - int otbMRFSamplerRandomMAP(int argc, char * argv[]) { const char * inputImage = argv[1]; const char * labelImage = argv[2]; const char * outputFile = argv[3]; - typedef double PixelTypeInput; - typedef int PixelTypeLabel; - typedef otb::Image<PixelTypeInput, 2> ImageType; - typedef otb::Image<PixelTypeLabel, 2> LabelType; - typedef otb::ImageFileReader< ImageType > ReaderInputType; - typedef otb::ImageFileReader< LabelType > ReaderLabelType; - typedef otb::MRFSamplerRandomMAP< ImageType, LabelType> MRFSamplerRandomMAPType; - - typedef otb::MRFEnergyPotts <ImageType, LabelType> EnergyFidelityType; - typedef otb::MRFEnergyPotts <LabelType, LabelType> EnergyRegularizationType; + typedef double PixelTypeInput; + typedef int PixelTypeLabel; + typedef otb::Image<PixelTypeInput, 2> ImageType; + typedef otb::Image<PixelTypeLabel, 2> LabelType; + typedef otb::ImageFileReader<ImageType> ReaderInputType; + typedef otb::ImageFileReader<LabelType> ReaderLabelType; + typedef otb::MRFSamplerRandomMAP<ImageType, LabelType> MRFSamplerRandomMAPType; + typedef otb::MRFEnergyPotts <ImageType, LabelType> EnergyFidelityType; + typedef otb::MRFEnergyPotts <LabelType, LabelType> EnergyRegularizationType; typedef MRFSamplerRandomMAPType::LabelledImageNeighborhoodIterator LabelledNeighborhoodIterator; typedef MRFSamplerRandomMAPType::InputImageNeighborhoodIterator InputNeighborhoodIterator; @@ -54,16 +52,15 @@ int otbMRFSamplerRandomMAP(int argc, char * argv[]) ReaderInputType::Pointer readerIn = ReaderInputType::New(); ReaderLabelType::Pointer readerLab = ReaderLabelType::New(); - - readerIn->SetFileName( inputImage ); - readerLab->SetFileName( labelImage ); + readerIn->SetFileName(inputImage); + readerLab->SetFileName(labelImage); readerIn->Update(); readerLab->Update(); object->SetNumberOfClasses(1); object->SetEnergyFidelity(energyFidelity); object->SetEnergyRegularization(energyRegularization); - object->InitializeSeed(0);// USED TO OVERPASS RANDOM CALCULATION + object->InitializeSeed(0); // USED TO OVERPASS RANDOM CALCULATION ImageType::IndexType idIn; LabelType::IndexType idLab; @@ -71,32 +68,34 @@ int otbMRFSamplerRandomMAP(int argc, char * argv[]) idIn[1] = 50; idLab[0] = 70; idLab[1] = 70; - ImageType::PixelType inPix = readerIn->GetOutput()->GetPixel( idIn ); - LabelType::PixelType inLab = readerLab->GetOutput()->GetPixel( idLab ); + ImageType::PixelType inPix = readerIn->GetOutput()->GetPixel(idIn); + LabelType::PixelType inLab = readerLab->GetOutput()->GetPixel(idLab); InputNeighborhoodIterator::RadiusType radIn; LabelledNeighborhoodIterator::RadiusType radLab; radIn.Fill(3); radLab.Fill(3); - InputNeighborhoodIterator iterIn = InputNeighborhoodIterator( radIn, readerIn->GetOutput(), readerIn->GetOutput()->GetLargestPossibleRegion()); - LabelledNeighborhoodIterator iterLab = LabelledNeighborhoodIterator( radLab, readerLab->GetOutput(), readerLab->GetOutput()->GetLargestPossibleRegion()); + InputNeighborhoodIterator iterIn = InputNeighborhoodIterator(radIn, readerIn->GetOutput(), + readerIn->GetOutput()->GetLargestPossibleRegion()); + LabelledNeighborhoodIterator iterLab = LabelledNeighborhoodIterator(radLab, + readerLab->GetOutput(), + readerLab->GetOutput()->GetLargestPossibleRegion()); std::ofstream file; file.open(outputFile); - file<<"Used pixels: (50, 50) -> "<<inPix<<" , (70, 70) -> "<<inLab<<std::endl; - file<<std::endl; - file<<"Compute( Compute( const InputImageNeighborhoodIterator, const LabelledImageNeighborhoodIterator) "<<object->Compute(iterIn, iterLab)<<std::endl; + file << "Used pixels: (50, 50) -> " << inPix << " , (70, 70) -> " << inLab << std::endl; + file << std::endl; + file << "Compute( Compute( const InputImageNeighborhoodIterator, const LabelledImageNeighborhoodIterator) " << + object->Compute(iterIn, iterLab) << std::endl; // All values (exept m_Value) are null : SingleValue return 0... - file<<"m_EnergyBefore: "<<object->GetEnergyBefore()<<std::endl; - file<<"m_EnergyAfter: "<<object->GetEnergyAfter()<<std::endl; - file<<"m_Value: "<<object->GetValue()<<std::endl; - file<<"m_DeltaEnergy: "<<object->GetDeltaEnergy()<<std::endl; - + file << "m_EnergyBefore: " << object->GetEnergyBefore() << std::endl; + file << "m_EnergyAfter: " << object->GetEnergyAfter() << std::endl; + file << "m_Value: " << object->GetValue() << std::endl; + file << "m_DeltaEnergy: " << object->GetDeltaEnergy() << std::endl; file.close(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMRFSamplerRandomMAPNew.cxx b/Testing/Code/Markov/otbMRFSamplerRandomMAPNew.cxx index 4b03478add..d4552644e0 100644 --- a/Testing/Code/Markov/otbMRFSamplerRandomMAPNew.cxx +++ b/Testing/Code/Markov/otbMRFSamplerRandomMAPNew.cxx @@ -22,16 +22,13 @@ #include "otbMRFSamplerRandomMAP.h" #include "otbImage.h" - int otbMRFSamplerRandomMAPNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::MRFSamplerRandomMAP< ImageType, ImageType> MRFSamplerRandomType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::MRFSamplerRandomMAP<ImageType, ImageType> MRFSamplerRandomType; MRFSamplerRandomType::Pointer object = MRFSamplerRandomType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Markov/otbMRFSamplerRandomNew.cxx b/Testing/Code/Markov/otbMRFSamplerRandomNew.cxx index d23a52f0d2..4aab2678b4 100644 --- a/Testing/Code/Markov/otbMRFSamplerRandomNew.cxx +++ b/Testing/Code/Markov/otbMRFSamplerRandomNew.cxx @@ -22,15 +22,13 @@ #include "otbMRFSamplerRandom.h" #include "otbImage.h" - int otbMRFSamplerRandomNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::MRFSamplerRandom< ImageType, ImageType> MRFSamplerRandomType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::MRFSamplerRandom<ImageType, ImageType> MRFSamplerRandomType; MRFSamplerRandomType::Pointer object = MRFSamplerRandomType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMarkovRandomFieldFilter.cxx b/Testing/Code/Markov/otbMarkovRandomFieldFilter.cxx index 3f2598e9f3..0ef24a3132 100644 --- a/Testing/Code/Markov/otbMarkovRandomFieldFilter.cxx +++ b/Testing/Code/Markov/otbMarkovRandomFieldFilter.cxx @@ -1,4 +1,3 @@ - /*========================================================================= Program: ORFEO Toolbox @@ -36,16 +35,16 @@ #include "otbMRFOptimizerMetropolis.h" #include "otbMRFSamplerRandom.h" -int otbMarkovRandomFieldFilter(int argc, char* argv[] ) +int otbMarkovRandomFieldFilter(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef double InternalPixelType; - typedef unsigned char LabelledPixelType; - typedef otb::Image<InternalPixelType, Dimension> InputImageType; - typedef otb::Image<LabelledPixelType, Dimension> LabelledImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< LabelledImageType > WriterType; + typedef double InternalPixelType; + typedef unsigned char LabelledPixelType; + typedef otb::Image<InternalPixelType, Dimension> InputImageType; + typedef otb::Image<LabelledPixelType, Dimension> LabelledImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<LabelledImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -53,16 +52,15 @@ int otbMarkovRandomFieldFilter(int argc, char* argv[] ) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); - typedef otb::MarkovRandomFieldFilter<InputImageType,LabelledImageType> MarkovRandomFieldFilterType; - typedef otb::MRFSamplerRandom< InputImageType, LabelledImageType> SamplerType; + typedef otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType> MarkovRandomFieldFilterType; + typedef otb::MRFSamplerRandom<InputImageType, LabelledImageType> SamplerType; typedef otb::MRFOptimizerMetropolis OptimizerType; typedef otb::MRFEnergyPotts<LabelledImageType, LabelledImageType> EnergyRegularizationType; typedef otb::MRFEnergyGaussianClassification<InputImageType, LabelledImageType> EnergyFidelityType; - MarkovRandomFieldFilterType::Pointer markovFilter = MarkovRandomFieldFilterType::New(); EnergyRegularizationType::Pointer energyRegularization = EnergyRegularizationType::New(); EnergyFidelityType::Pointer energyFidelity = EnergyFidelityType::New(); @@ -75,17 +73,17 @@ int otbMarkovRandomFieldFilter(int argc, char* argv[] ) markovFilter->InitializeSeed(2); unsigned int nClass = 4; - energyFidelity->SetNumberOfParameters(2*nClass); + energyFidelity->SetNumberOfParameters(2 * nClass); EnergyFidelityType::ParametersType parameters; parameters.SetSize(energyFidelity->GetNumberOfParameters()); - parameters[0]=10.0; //Class 0 mean - parameters[1]=10.0; //Class 0 stdev - parameters[2]=80.0;//Class 1 mean - parameters[3]=10.0; //Class 1 stdev - parameters[4]=150.0; //Class 2 mean - parameters[5]=10.0; //Class 2 stdev - parameters[6]=220.0;//Class 3 mean - parameters[7]=10.0; //Class 3 stde + parameters[0] = 10.0; //Class 0 mean + parameters[1] = 10.0; //Class 0 stdev + parameters[2] = 80.0; //Class 1 mean + parameters[3] = 10.0; //Class 1 stdev + parameters[4] = 150.0; //Class 2 mean + parameters[5] = 10.0; //Class 2 stdev + parameters[6] = 220.0; //Class 3 mean + parameters[7] = 10.0; //Class 3 stde energyFidelity->SetParameters(parameters); optimizer->SetSingleParameter(atof(argv[5])); @@ -103,18 +101,17 @@ int otbMarkovRandomFieldFilter(int argc, char* argv[] ) markovFilter->SetInput(reader->GetOutput()); typedef itk::RescaleIntensityImageFilter - < LabelledImageType, LabelledImageType > RescaleType; + <LabelledImageType, LabelledImageType> RescaleType; RescaleType::Pointer rescaleFilter = RescaleType::New(); rescaleFilter->SetOutputMinimum(0); rescaleFilter->SetOutputMaximum(255); - rescaleFilter->SetInput( markovFilter->GetOutput() ); + rescaleFilter->SetInput(markovFilter->GetOutput()); - writer->SetInput( rescaleFilter->GetOutput() ); + writer->SetInput(rescaleFilter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Markov/otbMarkovRandomFieldFilterNew.cxx b/Testing/Code/Markov/otbMarkovRandomFieldFilterNew.cxx index 43aabad180..129f1301f2 100644 --- a/Testing/Code/Markov/otbMarkovRandomFieldFilterNew.cxx +++ b/Testing/Code/Markov/otbMarkovRandomFieldFilterNew.cxx @@ -22,16 +22,13 @@ #include "otbMarkovRandomFieldFilter.h" #include "otbImage.h" - int otbMarkovRandomFieldFilterNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::MarkovRandomFieldFilter< ImageType, ImageType> MarkovRandomFieldFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::MarkovRandomFieldFilter<ImageType, ImageType> MarkovRandomFieldFilterType; MarkovRandomFieldFilterType::Pointer object = MarkovRandomFieldFilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Markov/otbMarkovTests1.cxx b/Testing/Code/Markov/otbMarkovTests1.cxx index fd7b1a7c64..1139e36bf1 100644 --- a/Testing/Code/Markov/otbMarkovTests1.cxx +++ b/Testing/Code/Markov/otbMarkovTests1.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -40,4 +39,3 @@ void RegisterTests() REGISTER_TEST(otbMRFOptimizerICMNew); REGISTER_TEST(otbMRFOptimizerICM); } - diff --git a/Testing/Code/Markov/otbMarkovTests2.cxx b/Testing/Code/Markov/otbMarkovTests2.cxx index d8c9fedf06..63c829f4f1 100644 --- a/Testing/Code/Markov/otbMarkovTests2.cxx +++ b/Testing/Code/Markov/otbMarkovTests2.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilter.cxx b/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilter.cxx index d5d2e2ac85..c56c231b2f 100644 --- a/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilter.cxx +++ b/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilter.cxx @@ -27,18 +27,18 @@ int otbConvexOrConcaveClassificationFilter(int argc, char * argv[]) const char * outfname = argv[3]; const double sigma = atof(argv[4]); - typedef otb::Image<double,2> InputImageType; - typedef otb::Image<unsigned char,2> OutputImageType; + typedef otb::Image<double, 2> InputImageType; + typedef otb::Image<unsigned char, 2> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; - typedef otb::ConvexOrConcaveClassificationFilter<InputImageType,OutputImageType> ClassificationFilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; + typedef otb::ConvexOrConcaveClassificationFilter<InputImageType, OutputImageType> ClassificationFilterType; // Instantiating objects ClassificationFilterType::Pointer filter = ClassificationFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - ReaderType::Pointer levelingReader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer levelingReader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(infname); levelingReader->SetFileName(levelingfname); diff --git a/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilterNew.cxx b/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilterNew.cxx index 393d47ec3d..fb05692c35 100644 --- a/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilterNew.cxx +++ b/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilterNew.cxx @@ -20,10 +20,10 @@ int otbConvexOrConcaveClassificationFilterNew(int argc, char * argv[]) { - typedef otb::Image<double,2> InputImageType; - typedef otb::Image<unsigned char,2> OutputImageType; + typedef otb::Image<double, 2> InputImageType; + typedef otb::Image<unsigned char, 2> OutputImageType; - typedef otb::ConvexOrConcaveClassificationFilter<InputImageType,OutputImageType> ClassificationFilterType; + typedef otb::ConvexOrConcaveClassificationFilter<InputImageType, OutputImageType> ClassificationFilterType; // Instantiating object ClassificationFilterType::Pointer filter = ClassificationFilterType::New(); diff --git a/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilter.cxx b/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilter.cxx index a7d69e1e11..041365d74c 100644 --- a/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilter.cxx +++ b/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilter.cxx @@ -25,18 +25,21 @@ int otbGeodesicMorphologyDecompositionImageFilter(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * convexfname = argv[2]; - const char * concavefname = argv[3]; - const char * levelingfname = argv[4]; + const char * infname = argv[1]; + const char * convexfname = argv[2]; + const char * concavefname = argv[3]; + const char * levelingfname = argv[4]; const unsigned int sesize = atoi(argv[5]); - typedef otb::Image<double,2> ImageType; - typedef itk::BinaryBallStructuringElement<double,2> StructuringElementType; - typedef StructuringElementType::RadiusType RadiusType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<double, 2> ImageType; + typedef itk::BinaryBallStructuringElement<double, + 2> StructuringElementType; + typedef StructuringElementType::RadiusType RadiusType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingImageFileWriter<ImageType> WriterType; - typedef otb::GeodesicMorphologyDecompositionImageFilter<ImageType,ImageType,StructuringElementType> GeodesicMorphologyDecompositionImageFilterType; + typedef otb::GeodesicMorphologyDecompositionImageFilter<ImageType, ImageType, + StructuringElementType> + GeodesicMorphologyDecompositionImageFilterType; // Instantiating object GeodesicMorphologyDecompositionImageFilterType::Pointer filter = GeodesicMorphologyDecompositionImageFilterType::New(); diff --git a/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilterNew.cxx b/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilterNew.cxx index 67f6ba0749..873fa0b051 100644 --- a/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilterNew.cxx +++ b/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilterNew.cxx @@ -21,9 +21,12 @@ int otbGeodesicMorphologyDecompositionImageFilterNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef itk::BinaryBallStructuringElement<double,2> StructuringElementType; - typedef otb::GeodesicMorphologyDecompositionImageFilter<ImageType,ImageType,StructuringElementType> GeodesicMorphologyDecompositionImageFilterType; + typedef otb::Image<double, 2> ImageType; + typedef itk::BinaryBallStructuringElement<double, + 2> StructuringElementType; + typedef otb::GeodesicMorphologyDecompositionImageFilter<ImageType, ImageType, + StructuringElementType> + GeodesicMorphologyDecompositionImageFilterType; // Instantiating object GeodesicMorphologyDecompositionImageFilterType::Pointer filter = GeodesicMorphologyDecompositionImageFilterType::New(); diff --git a/Testing/Code/MultiScale/otbGeodesicMorphologyIterativeDecompositionImageFilter.cxx b/Testing/Code/MultiScale/otbGeodesicMorphologyIterativeDecompositionImageFilter.cxx index a4e956e1bd..32f34128a9 100644 --- a/Testing/Code/MultiScale/otbGeodesicMorphologyIterativeDecompositionImageFilter.cxx +++ b/Testing/Code/MultiScale/otbGeodesicMorphologyIterativeDecompositionImageFilter.cxx @@ -27,9 +27,9 @@ int otbGeodesicMorphologyIterativeDecompositionImageFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilenamePrefix = argv[2]; - const char * outputFilenameSuffix = argv[3]; + const char * inputFilename = argv[1]; + const char * outputFilenamePrefix = argv[2]; + const char * outputFilenameSuffix = argv[3]; const unsigned int numberOfLevels = atoi(argv[4]); const unsigned int step = atoi(argv[5]); const unsigned int initValue = atoi(argv[6]); @@ -37,13 +37,16 @@ int otbGeodesicMorphologyIterativeDecompositionImageFilter(int argc, char * argv const unsigned int Dimension = 2; typedef double InputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<InputImageType> WriterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<InputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::GeodesicMorphologyIterativeDecompositionImageFilter<InputImageType,StructuringElementType> DecompositionImageFilterType; - typedef DecompositionImageFilterType::OutputImageListType::Iterator ImageListIterator; + typedef itk::BinaryBallStructuringElement<InputPixelType, + Dimension> StructuringElementType; + typedef otb::GeodesicMorphologyIterativeDecompositionImageFilter<InputImageType, + StructuringElementType> DecompositionImageFilterType; + typedef DecompositionImageFilterType::OutputImageListType::Iterator + ImageListIterator; // Reading input image ReaderType::Pointer reader = ReaderType::New(); @@ -57,7 +60,6 @@ int otbGeodesicMorphologyIterativeDecompositionImageFilter(int argc, char * argv decomposition->SetInput(reader->GetOutput()); decomposition->Update(); - // Retrieving iterators on the results images ImageListIterator itAnalyse = decomposition->GetOutput()->Begin(); ImageListIterator itConvexMap = decomposition->GetConvexOutput()->Begin(); @@ -65,27 +67,27 @@ int otbGeodesicMorphologyIterativeDecompositionImageFilter(int argc, char * argv WriterType::Pointer writer; - int i=1; + int i = 1; itk::OStringStream oss; // Writing the results images - while ((itAnalyse!=decomposition->GetOutput()->End()) - &&(itConvexMap!=decomposition->GetConvexOutput()->End()) - &&(itConcaveMap!=decomposition->GetConcaveOutput()->End()) - ) - { - oss<<outputFilenamePrefix<<"_leveling_"<<i<<"."<<outputFilenameSuffix; + while ((itAnalyse != decomposition->GetOutput()->End()) + && (itConvexMap != decomposition->GetConvexOutput()->End()) + && (itConcaveMap != decomposition->GetConcaveOutput()->End()) + ) + { + oss << outputFilenamePrefix << "_leveling_" << i << "." << outputFilenameSuffix; writer = WriterType::New(); writer->SetInput(itAnalyse.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); oss.str(""); - oss<<outputFilenamePrefix<<"_convMap_"<<i<<"."<<outputFilenameSuffix; + oss << outputFilenamePrefix << "_convMap_" << i << "." << outputFilenameSuffix; writer = WriterType::New(); writer->SetInput(itConvexMap.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); oss.str(""); - oss<<outputFilenamePrefix<<"_concMap_"<<i<<"."<<outputFilenameSuffix; + oss << outputFilenamePrefix << "_concMap_" << i << "." << outputFilenameSuffix; writer = WriterType::New(); writer->SetInput(itConcaveMap.Get()); writer->SetFileName(oss.str().c_str()); @@ -95,6 +97,6 @@ int otbGeodesicMorphologyIterativeDecompositionImageFilter(int argc, char * argv ++itConvexMap; ++itConcaveMap; ++i; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbGeodesicMorphologyIterativeDecompositionImageFilterNew.cxx b/Testing/Code/MultiScale/otbGeodesicMorphologyIterativeDecompositionImageFilterNew.cxx index 3d8fcf9ed0..58a90118b9 100644 --- a/Testing/Code/MultiScale/otbGeodesicMorphologyIterativeDecompositionImageFilterNew.cxx +++ b/Testing/Code/MultiScale/otbGeodesicMorphologyIterativeDecompositionImageFilterNew.cxx @@ -26,10 +26,12 @@ int otbGeodesicMorphologyIterativeDecompositionImageFilterNew(int argc, char * a const unsigned int Dimension = 2; typedef double InputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::GeodesicMorphologyIterativeDecompositionImageFilter<InputImageType,StructuringElementType> DecompositionFilterType; + typedef itk::BinaryBallStructuringElement<InputPixelType, + Dimension> StructuringElementType; + typedef otb::GeodesicMorphologyIterativeDecompositionImageFilter<InputImageType, + StructuringElementType> DecompositionFilterType; // Instantiation DecompositionFilterType::Pointer decomposition = DecompositionFilterType::New(); diff --git a/Testing/Code/MultiScale/otbGeodesicMorphologyLevelingFilter.cxx b/Testing/Code/MultiScale/otbGeodesicMorphologyLevelingFilter.cxx index 3ebb3e8c9e..7e0e28ce4e 100644 --- a/Testing/Code/MultiScale/otbGeodesicMorphologyLevelingFilter.cxx +++ b/Testing/Code/MultiScale/otbGeodesicMorphologyLevelingFilter.cxx @@ -27,12 +27,12 @@ int otbGeodesicMorphologyLevelingFilter(int argc, char * argv[]) const char * inconcfname = argv[3]; const char * outfname = argv[4]; - typedef otb::Image<double,2> ImageType; - typedef otb::GeodesicMorphologyLevelingFilter<ImageType,ImageType,ImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::Image<double, 2> ImageType; + typedef otb::GeodesicMorphologyLevelingFilter<ImageType, ImageType, ImageType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; - ReaderType::Pointer convreader,concreader,reader; + ReaderType::Pointer convreader, concreader, reader; reader = ReaderType::New(); convreader = ReaderType::New(); concreader = ReaderType::New(); @@ -52,6 +52,5 @@ int otbGeodesicMorphologyLevelingFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbGeodesicMorphologyLevelingFilterNew.cxx b/Testing/Code/MultiScale/otbGeodesicMorphologyLevelingFilterNew.cxx index 8aed9e29e2..8008e77fae 100644 --- a/Testing/Code/MultiScale/otbGeodesicMorphologyLevelingFilterNew.cxx +++ b/Testing/Code/MultiScale/otbGeodesicMorphologyLevelingFilterNew.cxx @@ -20,8 +20,8 @@ int otbGeodesicMorphologyLevelingFilterNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::GeodesicMorphologyLevelingFilter<ImageType,ImageType,ImageType> FilterType; + typedef otb::Image<double, 2> ImageType; + typedef otb::GeodesicMorphologyLevelingFilter<ImageType, ImageType, ImageType> FilterType; FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilter.cxx b/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilter.cxx index f41f22f103..d4a5a9ff3b 100644 --- a/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilter.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilter.cxx @@ -25,26 +25,25 @@ int otbMorphologicalClosingProfileFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilenamePrefix = argv[2]; - const char * outputFilenameSuffix = argv[3]; + const char * inputFilename = argv[1]; + const char * outputFilenamePrefix = argv[2]; + const char * outputFilenameSuffix = argv[3]; const unsigned int profileSize = atoi(argv[4]); const unsigned int initialValue = atoi(argv[5]); const unsigned int step = atoi(argv[5]); - const unsigned int Dimension = 2; typedef double InputPixelType; typedef double OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::MorphologicalClosingProfileFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::MorphologicalClosingProfileFilter<InputImageType, InputImageType, StructuringElementType> ClosingProfileFilterType; // Reading input image @@ -64,15 +63,15 @@ int otbMorphologicalClosingProfileFilter(int argc, char * argv[]) // std::stringstream oss; itk::OStringStream oss; // Writing the results images - for (unsigned int i = 1;i<=profileSize;++i) - { + for (unsigned int i = 1; i <= profileSize; ++i) + { writer = WriterType::New(); - oss<<outputFilenamePrefix<<i<<"."<<outputFilenameSuffix; - writer->SetInput(profileFilter->GetOutput()->GetNthElement(i-1)); + oss << outputFilenamePrefix << i << "." << outputFilenameSuffix; + writer->SetInput(profileFilter->GetOutput()->GetNthElement(i - 1)); writer->SetFileName(oss.str().c_str()); writer->Update(); oss.str(""); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilterNew.cxx b/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilterNew.cxx index bcf8817e27..611fa4e1fb 100644 --- a/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilterNew.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilterNew.cxx @@ -27,11 +27,11 @@ int otbMorphologicalClosingProfileFilterNew(int argc, char * argv[]) typedef double InputPixelType; typedef double OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::MorphologicalClosingProfileFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::MorphologicalClosingProfileFilter<InputImageType, InputImageType, StructuringElementType> ClosingProfileFilterType; // Instantiation diff --git a/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilter.cxx b/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilter.cxx index 59d68d811d..20754e7304 100644 --- a/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilter.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilter.cxx @@ -25,26 +25,25 @@ int otbMorphologicalOpeningProfileFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilenamePrefix = argv[2]; - const char * outputFilenameSuffix = argv[3]; + const char * inputFilename = argv[1]; + const char * outputFilenamePrefix = argv[2]; + const char * outputFilenameSuffix = argv[3]; const unsigned int profileSize = atoi(argv[4]); const unsigned int initialValue = atoi(argv[5]); const unsigned int step = atoi(argv[6]); - const unsigned int Dimension = 2; typedef double InputPixelType; typedef double OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::MorphologicalOpeningProfileFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::MorphologicalOpeningProfileFilter<InputImageType, InputImageType, StructuringElementType> OpeningProfileFilterType; // Reading input image @@ -64,15 +63,15 @@ int otbMorphologicalOpeningProfileFilter(int argc, char * argv[]) // std::stringstream oss; itk::OStringStream oss; // Writing the results images - for (unsigned int i = 1;i<=profileSize;++i) - { + for (unsigned int i = 1; i <= profileSize; ++i) + { writer = WriterType::New(); - oss<<outputFilenamePrefix<<i<<"."<<outputFilenameSuffix; - writer->SetInput(profileFilter->GetOutput()->GetNthElement(i-1)); + oss << outputFilenamePrefix << i << "." << outputFilenameSuffix; + writer->SetInput(profileFilter->GetOutput()->GetNthElement(i - 1)); writer->SetFileName(oss.str().c_str()); writer->Update(); oss.str(""); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilterNew.cxx b/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilterNew.cxx index 3597113476..59c1fb5c56 100644 --- a/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilterNew.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilterNew.cxx @@ -27,11 +27,11 @@ int otbMorphologicalOpeningProfileFilterNew(int argc, char * argv[]) typedef double InputPixelType; typedef double OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::MorphologicalOpeningProfileFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::MorphologicalOpeningProfileFilter<InputImageType, InputImageType, StructuringElementType> OpeningProfileFilterType; // Instantiation diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilter.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilter.cxx index 0cb950f249..ba11e468a6 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilter.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilter.cxx @@ -28,26 +28,26 @@ int otbMorphologicalPyramidAnalysisFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilenamePrefix = argv[2]; - const char * outputFilenameSuffix = argv[3]; + const char * inputFilename = argv[1]; + const char * outputFilenamePrefix = argv[2]; + const char * outputFilenameSuffix = argv[3]; const unsigned int numberOfLevels = atoi(argv[4]); - const float decimationRatio = atof(argv[5]); + const float decimationRatio = atof(argv[5]); const unsigned int Dimension = 2; typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::OpeningClosingMorphologicalFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::OpeningClosingMorphologicalFilter<InputImageType, InputImageType, StructuringElementType> OpeningClosingFilterType; - typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType,OutputImageType,OpeningClosingFilterType> + typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType, OutputImageType, OpeningClosingFilterType> PyramidFilterType; typedef PyramidFilterType::OutputImageListType::Iterator ImageListIterator; @@ -62,7 +62,6 @@ int otbMorphologicalPyramidAnalysisFilter(int argc, char * argv[]) pyramid->SetInput(reader->GetOutput()); pyramid->Update(); - // Retrieving iterators on the results images ImageListIterator itAnalyse = pyramid->GetOutput()->Begin(); ImageListIterator itSupFilter = pyramid->GetSupFilter()->Begin(); @@ -72,39 +71,39 @@ int otbMorphologicalPyramidAnalysisFilter(int argc, char * argv[]) WriterType::Pointer writer = WriterType::New(); - int i=1; + int i = 1; // std::stringstream oss; itk::OStringStream oss; // Writing the results images - while ((itAnalyse!=pyramid->GetOutput()->End()) - &&(itSupFilter!=pyramid->GetSupFilter()->End()) - &&(itInfFilter!=pyramid->GetInfFilter()->End()) - &&(itInfDeci!=pyramid->GetInfDeci()->End()) - &&(itSupDeci!=pyramid->GetSupDeci()->End()) - ) - { - oss<<outputFilenamePrefix<<"_an_"<<i<<"."<<outputFilenameSuffix; + while ((itAnalyse != pyramid->GetOutput()->End()) + && (itSupFilter != pyramid->GetSupFilter()->End()) + && (itInfFilter != pyramid->GetInfFilter()->End()) + && (itInfDeci != pyramid->GetInfDeci()->End()) + && (itSupDeci != pyramid->GetSupDeci()->End()) + ) + { + oss << outputFilenamePrefix << "_an_" << i << "." << outputFilenameSuffix; writer->SetInput(itAnalyse.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); oss.str(""); - oss<<outputFilenamePrefix<<"_sf_"<<i<<"."<<outputFilenameSuffix; + oss << outputFilenamePrefix << "_sf_" << i << "." << outputFilenameSuffix; writer->SetInput(itSupFilter.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); oss.str(""); - oss<<outputFilenamePrefix<<"_if_"<<i<<"."<<outputFilenameSuffix; + oss << outputFilenamePrefix << "_if_" << i << "." << outputFilenameSuffix; writer->SetInput(itInfFilter.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); oss.str(""); - oss<<outputFilenamePrefix<<"_id_"<<i<<"."<<outputFilenameSuffix; + oss << outputFilenamePrefix << "_id_" << i << "." << outputFilenameSuffix; writer->SetInput(itInfDeci.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); - std::cout<<"File "<<oss<<" written"<<std::endl; + std::cout << "File " << oss << " written" << std::endl; oss.str(""); - oss<<outputFilenamePrefix<<"_sd_"<<i<<"."<<outputFilenameSuffix; + oss << outputFilenamePrefix << "_sd_" << i << "." << outputFilenameSuffix; writer->SetInput(itSupDeci.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); @@ -115,7 +114,7 @@ int otbMorphologicalPyramidAnalysisFilter(int argc, char * argv[]) ++itInfDeci; ++itSupDeci; ++i; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilterNew.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilterNew.cxx index 3f81719e52..d2608869dd 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilterNew.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilterNew.cxx @@ -24,14 +24,14 @@ int otbMorphologicalPyramidAnalysisFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::OpeningClosingMorphologicalFilter<InputImageType,InputImageType,StructuringElementType> + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::OpeningClosingMorphologicalFilter<InputImageType, InputImageType, StructuringElementType> OpeningClosingFilterType; - typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType,OutputImageType,OpeningClosingFilterType> + typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType, OutputImageType, OpeningClosingFilterType> PyramidFilterType; // Instantiation PyramidFilterType::Pointer pyramid = PyramidFilterType::New(); diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverter.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverter.cxx index 2438f0ec4f..77adc81885 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverter.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverter.cxx @@ -27,30 +27,29 @@ int otbMorphologicalPyramidMRToMSConverter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilename1 = argv[2]; - const char * outputFilename2 = argv[3]; - const char * outputFilename3 = argv[4]; + const char * inputFilename = argv[1]; + const char * outputFilename1 = argv[2]; + const char * outputFilename2 = argv[3]; + const char * outputFilename3 = argv[4]; const unsigned int numberOfLevels = atoi(argv[5]); - const float decimationRatio = atof(argv[6]); + const float decimationRatio = atof(argv[6]); const unsigned int Dimension = 2; typedef double InputPixelType; typedef double OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::OpeningClosingMorphologicalFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::OpeningClosingMorphologicalFilter<InputImageType, InputImageType, StructuringElementType> OpeningClosingFilterType; - typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType,InputImageType,OpeningClosingFilterType> + typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType, InputImageType, OpeningClosingFilterType> PyramidAnalysisFilterType; - typedef otb::MorphologicalPyramid::MRToMSConverter<InputImageType,OutputImageType> MRToMSConverterType; - + typedef otb::MorphologicalPyramid::MRToMSConverter<InputImageType, OutputImageType> MRToMSConverterType; // Reading input image ReaderType::Pointer reader = ReaderType::New(); @@ -87,6 +86,5 @@ int otbMorphologicalPyramidMRToMSConverter(int argc, char * argv[]) writer3->SetInput(mrtoms->GetOutput()->Back()); writer3->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverterNew.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverterNew.cxx index b925c1b021..e889cb7109 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverterNew.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverterNew.cxx @@ -26,10 +26,9 @@ int otbMorphologicalPyramidMRToMSConverterNew(int argc, char * argv[]) typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::MorphologicalPyramid::MRToMSConverter<InputImageType,OutputImageType> MRToMSConverterType; - + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::MorphologicalPyramid::MRToMSConverter<InputImageType, OutputImageType> MRToMSConverterType; // Instantiation MRToMSConverterType::Pointer mrtoms = MRToMSConverterType::New(); diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidResampler.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidResampler.cxx index db26cf9320..63b64b7bb7 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidResampler.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidResampler.cxx @@ -23,9 +23,9 @@ int otbMorphologicalPyramidResampler(int argc, char * argv[]) { - const char* inputFilename = argv[1]; - const char* outputFilename1 = argv[2]; - const char* outputFilename2 = argv[3]; + const char* inputFilename = argv[1]; + const char* outputFilename1 = argv[2]; + const char* outputFilename2 = argv[3]; const unsigned int size_x = atoi(argv[4]); const unsigned int size_y = atoi(argv[5]); @@ -33,13 +33,13 @@ int otbMorphologicalPyramidResampler(int argc, char * argv[]) typedef double InputPixelType; typedef double OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::MorphologicalPyramid::Resampler<InputImageType,OutputImageType> + typedef otb::MorphologicalPyramid::Resampler<InputImageType, OutputImageType> ResamplerType; // Input image reading @@ -61,7 +61,6 @@ int otbMorphologicalPyramidResampler(int argc, char * argv[]) writer->SetFileName(outputFilename1); writer->Update(); - ResamplerType::Pointer resampler2 = ResamplerType::New(); resampler2->SetInput(resampler->GetOutput()); resampler2->SetSize(reader->GetOutput()->GetLargestPossibleRegion().GetSize()); @@ -71,6 +70,5 @@ int otbMorphologicalPyramidResampler(int argc, char * argv[]) writer2->SetFileName(outputFilename2); writer2->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidResamplerNew.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidResamplerNew.cxx index 1e38188ce9..cc5504561f 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidResamplerNew.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidResamplerNew.cxx @@ -25,15 +25,14 @@ int otbMorphologicalPyramidResamplerNew(int argc, char * argv[]) typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::MorphologicalPyramid::Resampler<InputImageType,OutputImageType> + typedef otb::MorphologicalPyramid::Resampler<InputImageType, OutputImageType> ResamplerType; // Instantiation ResamplerType::Pointer resampler = ResamplerType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilter.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilter.cxx index e91ac76720..a234d5c7af 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilter.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilter.cxx @@ -26,31 +26,31 @@ int otbMorphologicalPyramidSegmentationFilter(int argc, char * argv[]) { - const char* inputFilename = argv[1]; - const char* outputFilenamePrefix = argv[2]; - const char * outputFilenameSuffix = argv[3]; + const char* inputFilename = argv[1]; + const char* outputFilenamePrefix = argv[2]; + const char * outputFilenameSuffix = argv[3]; const unsigned int numberOfLevels = atoi(argv[4]); - const double decimationRatio = atof(argv[5]); - const float seedsQuantile = atof(argv[6]); - const float segmentationQuantile = atof(argv[7]); + const double decimationRatio = atof(argv[5]); + const float seedsQuantile = atof(argv[6]); + const float segmentationQuantile = atof(argv[7]); const unsigned int minObjectSize = atoi(argv[8]); const unsigned int Dimension = 2; - typedef double InputPixelType; + typedef double InputPixelType; typedef unsigned short OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::OpeningClosingMorphologicalFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::OpeningClosingMorphologicalFilter<InputImageType, InputImageType, StructuringElementType> OpeningClosingFilterType; - typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType,InputImageType,OpeningClosingFilterType> + typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType, InputImageType, OpeningClosingFilterType> PyramidFilterType; - typedef otb::MorphologicalPyramidSegmentationFilter<InputImageType,OutputImageType> + typedef otb::MorphologicalPyramidSegmentationFilter<InputImageType, OutputImageType> SegmentationFilterType; typedef SegmentationFilterType::OutputImageListIteratorType OutputListIteratorType; @@ -76,22 +76,21 @@ int otbMorphologicalPyramidSegmentationFilter(int argc, char * argv[]) // Output writing OutputListIteratorType it = segmentation->GetOutput()->Begin(); - WriterType::Pointer writer; - int index = 1; - std::stringstream oss; - while (it!=segmentation->GetOutput()->End()) - { - oss<<outputFilenamePrefix<<index<<"."<<outputFilenameSuffix; + WriterType::Pointer writer; + int index = 1; + std::stringstream oss; + while (it != segmentation->GetOutput()->End()) + { + oss << outputFilenamePrefix << index << "." << outputFilenameSuffix; writer = WriterType::New(); writer->SetInput(it.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); - std::cout<<oss.str()<<" file written."<<std::endl; + std::cout << oss.str() << " file written." << std::endl; oss.str(""); ++index; ++it; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilterNew.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilterNew.cxx index 48c3d94f6a..e35417ce92 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilterNew.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilterNew.cxx @@ -22,18 +22,17 @@ int otbMorphologicalPyramidSegmentationFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; + typedef unsigned char InputPixelType; typedef unsigned short OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::MorphologicalPyramidSegmentationFilter<InputImageType,OutputImageType> + typedef otb::MorphologicalPyramidSegmentationFilter<InputImageType, OutputImageType> SegmentationFilterType; // Instantiation SegmentationFilterType::Pointer segmentation = SegmentationFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenter.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenter.cxx index f11c98bb97..eb481f2718 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenter.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenter.cxx @@ -23,25 +23,25 @@ int otbMorphologicalPyramidSegmenter(int argc, char * argv[]) { - const char* inputFilename = argv[1]; - const char* originalFilename = argv[2]; - const char* outputFilename1 = argv[3]; - const bool segmentDark = atoi(argv[4]); - const float seedsQuantile = atof(argv[5]); - const float segmentationQuantile = atof(argv[6]); + const char* inputFilename = argv[1]; + const char* originalFilename = argv[2]; + const char* outputFilename1 = argv[3]; + const bool segmentDark = atoi(argv[4]); + const float seedsQuantile = atof(argv[5]); + const float segmentationQuantile = atof(argv[6]); const unsigned int minObjectSize = atoi(argv[7]); const unsigned int Dimension = 2; - typedef double InputPixelType; + typedef double InputPixelType; typedef unsigned short OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::MorphologicalPyramid::Segmenter<InputImageType,OutputImageType> + typedef otb::MorphologicalPyramid::Segmenter<InputImageType, OutputImageType> SegmenterType; // Input images reading diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenterNew.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenterNew.cxx index e5a12d0733..62d25604db 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenterNew.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenterNew.cxx @@ -22,18 +22,17 @@ int otbMorphologicalPyramidSegmenterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; + typedef unsigned char InputPixelType; typedef unsigned short OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::MorphologicalPyramid::Segmenter<InputImageType,OutputImageType> + typedef otb::MorphologicalPyramid::Segmenter<InputImageType, OutputImageType> SegmenterType; // Instantiation SegmenterType::Pointer segmenter = SegmenterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilter.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilter.cxx index 471820ad09..8e8f74096f 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilter.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilter.cxx @@ -27,27 +27,27 @@ int otbMorphologicalPyramidSynthesisFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; const unsigned int numberOfLevels = atoi(argv[3]); - const float decimationRatio = atof(argv[4]); + const float decimationRatio = atof(argv[4]); const unsigned int Dimension = 2; typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::OpeningClosingMorphologicalFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::OpeningClosingMorphologicalFilter<InputImageType, InputImageType, StructuringElementType> OpeningClosingFilterType; - typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType,OutputImageType,OpeningClosingFilterType> + typedef otb::MorphologicalPyramidAnalysisFilter<InputImageType, OutputImageType, OpeningClosingFilterType> PyramidAnalysisFilterType; - typedef otb::MorphologicalPyramidSynthesisFilter<InputImageType,OutputImageType> + typedef otb::MorphologicalPyramidSynthesisFilter<InputImageType, OutputImageType> PyramidSynthesisFilterType; // Reading input image @@ -76,6 +76,5 @@ int otbMorphologicalPyramidSynthesisFilter(int argc, char * argv[]) writer->SetInput(pyramidSynthesis->GetOutput()->Back()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilterNew.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilterNew.cxx index c61a5cd85f..e41cb5fac7 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilterNew.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilterNew.cxx @@ -17,7 +17,6 @@ =========================================================================*/ #include "itkExceptionObject.h" - #include "otbMorphologicalPyramidSynthesisFilter.h" #include "otbImage.h" @@ -27,10 +26,10 @@ int otbMorphologicalPyramidSynthesisFilterNew(int argc, char * argv[]) typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::MorphologicalPyramidSynthesisFilter<InputImageType,OutputImageType> + typedef otb::MorphologicalPyramidSynthesisFilter<InputImageType, OutputImageType> PyramidSynthesisFilterType; // Instantiation diff --git a/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilter.cxx b/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilter.cxx index c2d5281a2e..b869eebc20 100644 --- a/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilter.cxx +++ b/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilter.cxx @@ -29,36 +29,35 @@ int otbMultiScaleConvexOrConcaveClassificationFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; const unsigned int profileSize = atoi(argv[3]); const unsigned int initialValue = atoi(argv[4]); const unsigned int step = atoi(argv[5]); - const double sigma = atof(argv[6]); - + const double sigma = atof(argv[6]); const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef double OutputPixelType; + typedef double InputPixelType; + typedef double OutputPixelType; typedef unsigned short LabeledPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::Image<LabeledPixelType,2> LabeledImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::Image<LabeledPixelType, 2> LabeledImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::StreamingImageFileWriter<LabeledImageType> LabeledWriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::MorphologicalOpeningProfileFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::MorphologicalOpeningProfileFilter<InputImageType, InputImageType, StructuringElementType> OpeningProfileFilterType; - typedef otb::MorphologicalClosingProfileFilter<InputImageType,InputImageType,StructuringElementType> + typedef otb::MorphologicalClosingProfileFilter<InputImageType, InputImageType, StructuringElementType> ClosingProfileFilterType; - typedef otb::ProfileToProfileDerivativeFilter<InputImageType,InputImageType> DerivativeFilterType; - typedef otb::ProfileDerivativeToMultiScaleCharacteristicsFilter<InputImageType,OutputImageType,LabeledImageType> + typedef otb::ProfileToProfileDerivativeFilter<InputImageType, InputImageType> DerivativeFilterType; + typedef otb::ProfileDerivativeToMultiScaleCharacteristicsFilter<InputImageType, OutputImageType, LabeledImageType> MultiScaleCharacteristicsFilterType; - typedef otb::MultiScaleConvexOrConcaveClassificationFilter<InputImageType,LabeledImageType> MultiScaleClassificationFilterType; - + typedef otb::MultiScaleConvexOrConcaveClassificationFilter<InputImageType, + LabeledImageType> MultiScaleClassificationFilterType; // Reading input image ReaderType::Pointer reader = ReaderType::New(); @@ -99,7 +98,7 @@ int otbMultiScaleConvexOrConcaveClassificationFilter(int argc, char * argv[]) classificationFilter->SetClosingProfileDerivativeMaxima(cmsCharFilter->GetOutput()); classificationFilter->SetClosingProfileCharacteristics(cmsCharFilter->GetOutputCharacteristics()); classificationFilter->SetSigma(sigma); - classificationFilter->SetLabelSeparator(initialValue+profileSize*step); + classificationFilter->SetLabelSeparator(initialValue + profileSize * step); LabeledWriterType::Pointer labeledWriter = LabeledWriterType::New(); diff --git a/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilterNew.cxx b/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilterNew.cxx index 6049e15141..bbde444e58 100644 --- a/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilterNew.cxx +++ b/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilterNew.cxx @@ -23,15 +23,16 @@ int otbMultiScaleConvexOrConcaveClassificationFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef double OutputPixelType; + typedef double InputPixelType; + typedef double OutputPixelType; typedef unsigned short LabeledPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::Image<LabeledPixelType,2> LabeledImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::Image<LabeledPixelType, 2> LabeledImageType; - typedef otb::MultiScaleConvexOrConcaveClassificationFilter<InputImageType,LabeledImageType> MultiScaleClassificationFilterType; + typedef otb::MultiScaleConvexOrConcaveClassificationFilter<InputImageType, + LabeledImageType> MultiScaleClassificationFilterType; // Instantiation MultiScaleClassificationFilterType::Pointer classificationFilter = MultiScaleClassificationFilterType::New(); diff --git a/Testing/Code/MultiScale/otbProfileDerivativeToMultiScaleCharacteristicsFilter.cxx b/Testing/Code/MultiScale/otbProfileDerivativeToMultiScaleCharacteristicsFilter.cxx index d94bcd2c09..1c33578e5e 100644 --- a/Testing/Code/MultiScale/otbProfileDerivativeToMultiScaleCharacteristicsFilter.cxx +++ b/Testing/Code/MultiScale/otbProfileDerivativeToMultiScaleCharacteristicsFilter.cxx @@ -27,32 +27,31 @@ int otbProfileDerivativeToMultiScaleCharacteristicsFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilename1 = argv[2]; - const char * outputFilename2 = argv[3]; + const char * inputFilename = argv[1]; + const char * outputFilename1 = argv[2]; + const char * outputFilename2 = argv[3]; const unsigned int profileSize = atoi(argv[4]); const unsigned int initialValue = atoi(argv[5]); const unsigned int step = atoi(argv[6]); - const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef double OutputPixelType; + typedef double InputPixelType; + typedef double OutputPixelType; typedef unsigned short LabeledPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::Image<LabeledPixelType,2> LabeledImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::Image<LabeledPixelType, 2> LabeledImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; typedef otb::StreamingImageFileWriter<LabeledImageType> LabeledWriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::MorphologicalOpeningProfileFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::MorphologicalOpeningProfileFilter<InputImageType, InputImageType, StructuringElementType> OpeningProfileFilterType; - typedef otb::ProfileToProfileDerivativeFilter<InputImageType,InputImageType> DerivativeFilterType; - typedef otb::ProfileDerivativeToMultiScaleCharacteristicsFilter<InputImageType,OutputImageType,LabeledImageType> + typedef otb::ProfileToProfileDerivativeFilter<InputImageType, InputImageType> DerivativeFilterType; + typedef otb::ProfileDerivativeToMultiScaleCharacteristicsFilter<InputImageType, OutputImageType, LabeledImageType> MultiScaleCharacteristicsFilterType; // Reading input image @@ -74,8 +73,7 @@ int otbProfileDerivativeToMultiScaleCharacteristicsFilter(int argc, char * argv[ msCharFilter->SetInitialValue(initialValue); msCharFilter->SetStep(step); - - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); LabeledWriterType::Pointer labeledWriter = LabeledWriterType::New(); writer->SetFileName(outputFilename1); diff --git a/Testing/Code/MultiScale/otbProfileDerivativeToMultiScaleCharacteristicsFilterNew.cxx b/Testing/Code/MultiScale/otbProfileDerivativeToMultiScaleCharacteristicsFilterNew.cxx index 29ef23255e..af828a5b8e 100644 --- a/Testing/Code/MultiScale/otbProfileDerivativeToMultiScaleCharacteristicsFilterNew.cxx +++ b/Testing/Code/MultiScale/otbProfileDerivativeToMultiScaleCharacteristicsFilterNew.cxx @@ -22,15 +22,15 @@ int otbProfileDerivativeToMultiScaleCharacteristicsFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef double OutputPixelType; + typedef double InputPixelType; + typedef double OutputPixelType; typedef unsigned short LabeledPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::Image<LabeledPixelType,2> LabeledImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::Image<LabeledPixelType, 2> LabeledImageType; - typedef otb::ProfileDerivativeToMultiScaleCharacteristicsFilter<InputImageType,OutputImageType,LabeledImageType> + typedef otb::ProfileDerivativeToMultiScaleCharacteristicsFilter<InputImageType, OutputImageType, LabeledImageType> MultiScaleCharacteristicsFilterType; MultiScaleCharacteristicsFilterType::Pointer msCharFilter = MultiScaleCharacteristicsFilterType::New(); diff --git a/Testing/Code/MultiScale/otbProfileToProfileDerivativeFilter.cxx b/Testing/Code/MultiScale/otbProfileToProfileDerivativeFilter.cxx index bbe8a74fca..d67d67c81f 100644 --- a/Testing/Code/MultiScale/otbProfileToProfileDerivativeFilter.cxx +++ b/Testing/Code/MultiScale/otbProfileToProfileDerivativeFilter.cxx @@ -26,28 +26,27 @@ int otbProfileToProfileDerivativeFilter(int argc, char * argv[]) { - const char * inputFilename = argv[1]; - const char * outputFilenamePrefix = argv[2]; - const char * outputFilenameSuffix = argv[3]; + const char * inputFilename = argv[1]; + const char * outputFilenamePrefix = argv[2]; + const char * outputFilenameSuffix = argv[3]; const unsigned int profileSize = atoi(argv[4]); const unsigned int initialValue = atoi(argv[5]); const unsigned int step = atoi(argv[5]); - const unsigned int Dimension = 2; typedef double InputPixelType; typedef double OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; - typedef itk::BinaryBallStructuringElement<InputPixelType,Dimension> StructuringElementType; - typedef otb::MorphologicalOpeningProfileFilter<InputImageType,InputImageType,StructuringElementType> + typedef itk::BinaryBallStructuringElement<InputPixelType, Dimension> StructuringElementType; + typedef otb::MorphologicalOpeningProfileFilter<InputImageType, InputImageType, StructuringElementType> OpeningProfileFilterType; - typedef otb::ProfileToProfileDerivativeFilter<InputImageType,OutputImageType> DerivativeFilterType; + typedef otb::ProfileToProfileDerivativeFilter<InputImageType, OutputImageType> DerivativeFilterType; // Reading input image ReaderType::Pointer reader = ReaderType::New(); @@ -69,15 +68,15 @@ int otbProfileToProfileDerivativeFilter(int argc, char * argv[]) // std::stringstream oss; itk::OStringStream oss; // Writing the results images - for (unsigned int i = 1;i<profileSize;++i) - { + for (unsigned int i = 1; i < profileSize; ++i) + { writer = WriterType::New(); - oss<<outputFilenamePrefix<<i<<"."<<outputFilenameSuffix; - writer->SetInput(derivativeFilter->GetOutput()->GetNthElement(i-1)); + oss << outputFilenamePrefix << i << "." << outputFilenameSuffix; + writer->SetInput(derivativeFilter->GetOutput()->GetNthElement(i - 1)); writer->SetFileName(oss.str().c_str()); writer->Update(); oss.str(""); - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/MultiScale/otbProfileToProfileDerivativeFilterNew.cxx b/Testing/Code/MultiScale/otbProfileToProfileDerivativeFilterNew.cxx index 4db9c93fde..6703e93f67 100644 --- a/Testing/Code/MultiScale/otbProfileToProfileDerivativeFilterNew.cxx +++ b/Testing/Code/MultiScale/otbProfileToProfileDerivativeFilterNew.cxx @@ -26,9 +26,9 @@ int otbProfileToProfileDerivativeFilterNew(int argc, char * argv[]) typedef double InputPixelType; typedef double OutputPixelType; - typedef otb::Image<InputPixelType,Dimension> InputImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ProfileToProfileDerivativeFilter<InputImageType,OutputImageType> DerivativeFilterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ProfileToProfileDerivativeFilter<InputImageType, OutputImageType> DerivativeFilterType; DerivativeFilterType::Pointer derivativeFilter = DerivativeFilterType::New(); diff --git a/Testing/Code/MultiScale/otbSubsampleImageFilter.cxx b/Testing/Code/MultiScale/otbSubsampleImageFilter.cxx index ba100b730a..3b74e00375 100644 --- a/Testing/Code/MultiScale/otbSubsampleImageFilter.cxx +++ b/Testing/Code/MultiScale/otbSubsampleImageFilter.cxx @@ -27,45 +27,44 @@ #include "otbSubsampleImageFilter.h" -int otbSubsampleImageFilter ( int argc, char * argv[] ) +int otbSubsampleImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; - const char * outputFileName1 = argv[2]; + const char * outputFileName1 = argv[2]; const char * outputFileName2 = argv[3]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFileName ); + reader->SetFileName(inputFileName); - typedef otb::SubsampleImageFilter< ImageType, ImageType, otb::Wavelet::INVERSE > - InvFilterType; + typedef otb::SubsampleImageFilter<ImageType, ImageType, otb::Wavelet::INVERSE> + InvFilterType; InvFilterType::Pointer invFilter = InvFilterType::New(); - invFilter->SetInput( reader->GetOutput() ); + invFilter->SetInput(reader->GetOutput()); itk::Index<Dimension> delta = {{2, 2}}; - invFilter->SetSubsampleFactor( delta ); + invFilter->SetSubsampleFactor(delta); - typedef otb::ImageFileWriter< ImageType > WriterType; + typedef otb::ImageFileWriter<ImageType> WriterType; WriterType::Pointer writer1 = WriterType::New(); - writer1->SetFileName( outputFileName1 ); - writer1->SetInput( invFilter->GetOutput() ); + writer1->SetFileName(outputFileName1); + writer1->SetInput(invFilter->GetOutput()); writer1->Update(); - typedef otb::SubsampleImageFilter< ImageType, ImageType, otb::Wavelet::FORWARD > - ForwardFilterType; + typedef otb::SubsampleImageFilter<ImageType, ImageType, otb::Wavelet::FORWARD> + ForwardFilterType; ForwardFilterType::Pointer filter = ForwardFilterType::New(); - filter->SetInput( invFilter->GetOutput() ); - filter->SetSubsampleFactor( invFilter->GetSubsampleFactor() ); + filter->SetInput(invFilter->GetOutput()); + filter->SetSubsampleFactor(invFilter->GetSubsampleFactor()); WriterType::Pointer writer2 = WriterType::New(); - writer2->SetFileName( outputFileName2 ); - writer2->SetInput( filter->GetOutput() ); + writer2->SetFileName(outputFileName2); + writer2->SetInput(filter->GetOutput()); writer2->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/MultiScale/otbSubsampleImageFilterNew.cxx b/Testing/Code/MultiScale/otbSubsampleImageFilterNew.cxx index 4e6bb396a0..01772b5ebe 100644 --- a/Testing/Code/MultiScale/otbSubsampleImageFilterNew.cxx +++ b/Testing/Code/MultiScale/otbSubsampleImageFilterNew.cxx @@ -27,16 +27,15 @@ #include "otbSubsampleImageFilter.h" -int otbSubsampleImageFilterNew ( int argc, char * argv[] ) +int otbSubsampleImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::SubsampleImageFilter< ImageType, ImageType, otb::Wavelet::FORWARD > - FilterType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::SubsampleImageFilter<ImageType, ImageType, otb::Wavelet::FORWARD> + FilterType; FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/MultiScale/otbWaveletFilterBank.cxx b/Testing/Code/MultiScale/otbWaveletFilterBank.cxx index 2b6725e635..f667919d1a 100644 --- a/Testing/Code/MultiScale/otbWaveletFilterBank.cxx +++ b/Testing/Code/MultiScale/otbWaveletFilterBank.cxx @@ -28,50 +28,48 @@ #include "otbWaveletOperator.h" #include "otbWaveletFilterBank.h" -int otbWaveletFilterBank( int argc, char * argv[] ) +int otbWaveletFilterBank(int argc, char * argv[]) { - const char * inputFileName = argv[1]; + const char * inputFileName = argv[1]; const unsigned int decimFactor = atoi(argv[2]); // 1 for multiscale, 2 for multiresolution - const char * outputFileName = argv[3]; + const char * outputFileName = argv[3]; const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; /* Reading */ ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFileName ); + reader->SetFileName(inputFileName); /* Wavelet choice */ //const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; const otb::Wavelet::Wavelet wvltID = otb::Wavelet::SYMLET8; /* Forward Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::FORWARD, PixelType, Dimension > WaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD > - FilterType; + typedef otb::WaveletOperator<wvltID, otb::Wavelet::FORWARD, PixelType, Dimension> WaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD> + FilterType; FilterType::Pointer filter = FilterType::New(); - filter->SetInput( reader->GetOutput() ); - filter->SetSubsampleImageFactor( decimFactor ); + filter->SetInput(reader->GetOutput()); + filter->SetSubsampleImageFactor(decimFactor); /* Inverse Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::INVERSE, PixelType, Dimension > InvWaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, InvWaveletOperator, otb::Wavelet::INVERSE > - InvFilterType; + typedef otb::WaveletOperator<wvltID, otb::Wavelet::INVERSE, PixelType, Dimension> InvWaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, InvWaveletOperator, otb::Wavelet::INVERSE> + InvFilterType; InvFilterType::Pointer invFilter = InvFilterType::New(); - for ( unsigned int i = 0; i < filter->GetNumberOfOutputs(); i++ ) - invFilter->SetInput( i, filter->GetOutput(i) ); - invFilter->SetSubsampleImageFactor( filter->GetSubsampleImageFactor() ); + for (unsigned int i = 0; i < filter->GetNumberOfOutputs(); i++) + invFilter->SetInput(i, filter->GetOutput(i)); + invFilter->SetSubsampleImageFactor(filter->GetSubsampleImageFactor()); /* Saving output */ - typedef otb::ImageFileWriter< ImageType > WriterType; + typedef otb::ImageFileWriter<ImageType> WriterType; WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFileName ); - writer->SetInput( invFilter->GetOutput() ); + writer->SetFileName(outputFileName); + writer->SetInput(invFilter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/MultiScale/otbWaveletFilterBankNew.cxx b/Testing/Code/MultiScale/otbWaveletFilterBankNew.cxx index ece352f66e..d1b2925b81 100644 --- a/Testing/Code/MultiScale/otbWaveletFilterBankNew.cxx +++ b/Testing/Code/MultiScale/otbWaveletFilterBankNew.cxx @@ -23,18 +23,17 @@ int otbWaveletFilterBankNew(int argc, char * argv[]) { const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; /* Wavelet choice */ //const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; const otb::Wavelet::Wavelet wvltID = otb::Wavelet::DB4; - typedef otb::WaveletOperator< wvltID, otb::Wavelet::FORWARD, PixelType, Dimension > WaveletOperator; + typedef otb::WaveletOperator<wvltID, otb::Wavelet::FORWARD, PixelType, Dimension> WaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD > - FilterType; + typedef otb::WaveletFilterBank<ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD> + FilterType; FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/MultiScale/otbWaveletInverseFilterBankNew.cxx b/Testing/Code/MultiScale/otbWaveletInverseFilterBankNew.cxx index 0b31eecbb1..56e8fcff08 100644 --- a/Testing/Code/MultiScale/otbWaveletInverseFilterBankNew.cxx +++ b/Testing/Code/MultiScale/otbWaveletInverseFilterBankNew.cxx @@ -23,19 +23,18 @@ int otbWaveletInverseFilterBankNew(int argc, char * argv[]) { const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; /* Wavelet choice */ //const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; const otb::Wavelet::Wavelet wvltID = otb::Wavelet::SYMLET8; /* Inverse Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::INVERSE, PixelType, Dimension > WaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, WaveletOperator, otb::Wavelet::INVERSE > - FilterType; + typedef otb::WaveletOperator<wvltID, otb::Wavelet::INVERSE, PixelType, Dimension> WaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, WaveletOperator, otb::Wavelet::INVERSE> + FilterType; FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/MultiScale/otbWaveletInverseTransformNew.cxx b/Testing/Code/MultiScale/otbWaveletInverseTransformNew.cxx index d0e53245a7..9f28002b9c 100644 --- a/Testing/Code/MultiScale/otbWaveletInverseTransformNew.cxx +++ b/Testing/Code/MultiScale/otbWaveletInverseTransformNew.cxx @@ -26,22 +26,21 @@ int otbWaveletInverseTransformNew(int argc, char * argv[]) { const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; /* Wavelet choice */ const otb::Wavelet::Wavelet wvltID = otb::Wavelet::SYMLET8; /* Inverse Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::INVERSE, PixelType, Dimension > - InverseWaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, InverseWaveletOperator, otb::Wavelet::INVERSE > - InverseFilterBank; - typedef otb::WaveletTransform< ImageType, ImageType, InverseFilterBank, otb::Wavelet::INVERSE > - InvFilterType; - + typedef otb::WaveletOperator<wvltID, otb::Wavelet::INVERSE, PixelType, Dimension> + InverseWaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, InverseWaveletOperator, otb::Wavelet::INVERSE> + InverseFilterBank; + typedef otb::WaveletTransform<ImageType, ImageType, InverseFilterBank, otb::Wavelet::INVERSE> + InvFilterType; + InvFilterType::Pointer invFilter = InvFilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/MultiScale/otbWaveletOperator.cxx b/Testing/Code/MultiScale/otbWaveletOperator.cxx index bf6a73ac3e..79ac6caba9 100644 --- a/Testing/Code/MultiScale/otbWaveletOperator.cxx +++ b/Testing/Code/MultiScale/otbWaveletOperator.cxx @@ -23,15 +23,14 @@ int otbWaveletOperator(int argc, char * argv[]) { const otb::Wavelet::WaveletDirection directionID = otb::Wavelet::FORWARD; - const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; + const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; const int Dimension = 2; typedef double PixelType; - - typedef otb::WaveletOperator< wvltID, directionID, PixelType, Dimension > - WaveletOperator; - typedef WaveletOperator::LowPassOperator LowPassOperatorType; + typedef otb::WaveletOperator<wvltID, directionID, PixelType, Dimension> + WaveletOperator; + typedef WaveletOperator::LowPassOperator LowPassOperatorType; typedef WaveletOperator::HighPassOperator HighPassOperatorType; LowPassOperatorType h_filter; @@ -46,5 +45,3 @@ int otbWaveletOperator(int argc, char * argv[]) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/MultiScale/otbWaveletOperatorNew.cxx b/Testing/Code/MultiScale/otbWaveletOperatorNew.cxx index 7687ff7939..44b102b211 100644 --- a/Testing/Code/MultiScale/otbWaveletOperatorNew.cxx +++ b/Testing/Code/MultiScale/otbWaveletOperatorNew.cxx @@ -23,14 +23,13 @@ int otbWaveletOperatorNew(int argc, char * argv[]) { const otb::Wavelet::WaveletDirection directionID = otb::Wavelet::INVERSE; - const otb::Wavelet::Wavelet wvltID = otb::Wavelet::SPLINE_BIORTHOGONAL_4_4; + const otb::Wavelet::Wavelet wvltID = otb::Wavelet::SPLINE_BIORTHOGONAL_4_4; const int Dimension = 2; typedef double PixelType; - - typedef otb::WaveletOperator< wvltID, directionID, PixelType, Dimension > - WaveletOperator; + typedef otb::WaveletOperator<wvltID, directionID, PixelType, Dimension> + WaveletOperator; typedef WaveletOperator::LowPassOperator LowPassOperatorType; LowPassOperatorType h_filter; @@ -40,5 +39,3 @@ int otbWaveletOperatorNew(int argc, char * argv[]) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/MultiScale/otbWaveletPacketInverseTransformNew.cxx b/Testing/Code/MultiScale/otbWaveletPacketInverseTransformNew.cxx index 73c4cbaec9..5c81ec0b2a 100644 --- a/Testing/Code/MultiScale/otbWaveletPacketInverseTransformNew.cxx +++ b/Testing/Code/MultiScale/otbWaveletPacketInverseTransformNew.cxx @@ -27,23 +27,22 @@ int otbWaveletPacketInverseTransformNew(int argc, char * argv[]) { const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; /* Wavelet choice */ //const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; const otb::Wavelet::Wavelet wvltID = otb::Wavelet::DB8; /* Inverse Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::INVERSE, PixelType, Dimension > - InverseWaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, InverseWaveletOperator, otb::Wavelet::INVERSE > - InverseFilterBank; - typedef otb::WaveletPacketTransform< ImageType, ImageType, InverseFilterBank, otb::Wavelet::INVERSE > - InvFilterType; - + typedef otb::WaveletOperator<wvltID, otb::Wavelet::INVERSE, PixelType, Dimension> + InverseWaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, InverseWaveletOperator, otb::Wavelet::INVERSE> + InverseFilterBank; + typedef otb::WaveletPacketTransform<ImageType, ImageType, InverseFilterBank, otb::Wavelet::INVERSE> + InvFilterType; + InvFilterType::Pointer invFilter = InvFilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/MultiScale/otbWaveletPacketTransform.cxx b/Testing/Code/MultiScale/otbWaveletPacketTransform.cxx index 5b0f84a8ca..ea475010d0 100644 --- a/Testing/Code/MultiScale/otbWaveletPacketTransform.cxx +++ b/Testing/Code/MultiScale/otbWaveletPacketTransform.cxx @@ -30,65 +30,63 @@ #include "otbWaveletPacketTransform.h" #include "otbWaveletPacketDecompositionCosts.h" -int otbWaveletPacketTransform( int argc, char * argv[] ) +int otbWaveletPacketTransform(int argc, char * argv[]) { - const char * inputFileName = argv[1]; + const char * inputFileName = argv[1]; const unsigned int level = atoi(argv[2]); const unsigned int decimFactor = atoi(argv[3]); - const char * outputFileName = argv[4]; + const char * outputFileName = argv[4]; const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; /* Reading */ ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFileName ); + reader->SetFileName(inputFileName); /* Wavelet choice */ const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; // const otb::Wavelet::Wavelet wvltID = otb::Wavelet::SYMLET8; /* Wavelet packet configuration */ - typedef otb::FullyDecomposedWaveletPacketCost< ImageType > CostType; + typedef otb::FullyDecomposedWaveletPacketCost<ImageType> CostType; CostType::NumberOfAllowedDecompositions = level; - + /* Forward Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::FORWARD, PixelType, Dimension > - WaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD > - ForwardFilterBank; - typedef otb::WaveletPacketTransform< ImageType, ImageType, ForwardFilterBank, otb::Wavelet::FORWARD, CostType > - FilterType; - + typedef otb::WaveletOperator<wvltID, otb::Wavelet::FORWARD, PixelType, Dimension> + WaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD> + ForwardFilterBank; + typedef otb::WaveletPacketTransform<ImageType, ImageType, ForwardFilterBank, otb::Wavelet::FORWARD, CostType> + FilterType; + FilterType::Pointer filter = FilterType::New(); - filter->SetInput( reader->GetOutput() ); - filter->SetSubsampleImageFactor( decimFactor ); + filter->SetInput(reader->GetOutput()); + filter->SetSubsampleImageFactor(decimFactor); filter->Update(); /* Inverse Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::INVERSE, PixelType, Dimension > - InverseWaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, InverseWaveletOperator, otb::Wavelet::INVERSE > - InverseFilterBank; - typedef otb::WaveletPacketTransform< ImageType, ImageType, InverseFilterBank, otb::Wavelet::INVERSE > - InvFilterType; - + typedef otb::WaveletOperator<wvltID, otb::Wavelet::INVERSE, PixelType, Dimension> + InverseWaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, InverseWaveletOperator, otb::Wavelet::INVERSE> + InverseFilterBank; + typedef otb::WaveletPacketTransform<ImageType, ImageType, InverseFilterBank, otb::Wavelet::INVERSE> + InvFilterType; + InvFilterType::Pointer invFilter = InvFilterType::New(); - invFilter->SetInput( filter->GetOutput() ); - invFilter->SetWaveletPacketRule( filter->GetWaveletPacketRule() ); - invFilter->SetSubsampleImageFactor( decimFactor ); + invFilter->SetInput(filter->GetOutput()); + invFilter->SetWaveletPacketRule(filter->GetWaveletPacketRule()); + invFilter->SetSubsampleImageFactor(decimFactor); invFilter->Update(); /* Writing the output */ - typedef otb::ImageFileWriter< ImageType > WriterType; + typedef otb::ImageFileWriter<ImageType> WriterType; WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFileName ); - writer->SetInput( invFilter->GetOutput() ); + writer->SetFileName(outputFileName); + writer->SetInput(invFilter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/MultiScale/otbWaveletPacketTransformNew.cxx b/Testing/Code/MultiScale/otbWaveletPacketTransformNew.cxx index c9c2477ca4..9e058f93bd 100644 --- a/Testing/Code/MultiScale/otbWaveletPacketTransformNew.cxx +++ b/Testing/Code/MultiScale/otbWaveletPacketTransformNew.cxx @@ -25,28 +25,26 @@ int otbWaveletPacketTransformNew(int argc, char * argv[]) { const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; /* Wavelet choice */ const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; // const otb::Wavelet::Wavelet wvltID = otb::Wavelet::SYMLET8; /* Wavelet packet configuration */ - typedef otb::FullyDecomposedWaveletPacketCost< ImageType > CostType; + typedef otb::FullyDecomposedWaveletPacketCost<ImageType> CostType; CostType::NumberOfAllowedDecompositions = 1; - + /* Forward Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::FORWARD, PixelType, Dimension > - WaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD > - ForwardFilterBank; - typedef otb::WaveletPacketTransform< ImageType, ImageType, ForwardFilterBank, otb::Wavelet::FORWARD, CostType > - FilterType; - + typedef otb::WaveletOperator<wvltID, otb::Wavelet::FORWARD, PixelType, Dimension> + WaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD> + ForwardFilterBank; + typedef otb::WaveletPacketTransform<ImageType, ImageType, ForwardFilterBank, otb::Wavelet::FORWARD, CostType> + FilterType; + FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/MultiScale/otbWaveletTransform.cxx b/Testing/Code/MultiScale/otbWaveletTransform.cxx index d612690122..58d3825c9c 100644 --- a/Testing/Code/MultiScale/otbWaveletTransform.cxx +++ b/Testing/Code/MultiScale/otbWaveletTransform.cxx @@ -30,60 +30,58 @@ #include "otbWaveletFilterBank.h" #include "otbWaveletTransform.h" -int otbWaveletTransform( int argc, char * argv[] ) +int otbWaveletTransform(int argc, char * argv[]) { - const char * inputFileName = argv[1]; + const char * inputFileName = argv[1]; const unsigned int level = atoi(argv[2]); const unsigned int decimFactor = atoi(argv[3]); - const char * outputFileName = argv[4]; + const char * outputFileName = argv[4]; const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; /* Reading */ ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFileName ); + reader->SetFileName(inputFileName); /* Wavelet choice */ const otb::Wavelet::Wavelet wvltID = otb::Wavelet::HAAR; /* Forward Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::FORWARD, PixelType, Dimension > - WaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD > - ForwardFilterBank; - typedef otb::WaveletTransform< ImageType, ImageType, ForwardFilterBank, otb::Wavelet::FORWARD > - FilterType; - + typedef otb::WaveletOperator<wvltID, otb::Wavelet::FORWARD, PixelType, Dimension> + WaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD> + ForwardFilterBank; + typedef otb::WaveletTransform<ImageType, ImageType, ForwardFilterBank, otb::Wavelet::FORWARD> + FilterType; + FilterType::Pointer filter = FilterType::New(); - filter->SetInput( reader->GetOutput() ); - filter->SetNumberOfDecompositions( level ); - filter->SetSubsampleImageFactor( decimFactor ); + filter->SetInput(reader->GetOutput()); + filter->SetNumberOfDecompositions(level); + filter->SetSubsampleImageFactor(decimFactor); filter->Update(); /* Inverse Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::INVERSE, PixelType, Dimension > - InverseWaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, InverseWaveletOperator, otb::Wavelet::INVERSE > - InverseFilterBank; - typedef otb::WaveletTransform< ImageType, ImageType, InverseFilterBank, otb::Wavelet::INVERSE > - InvFilterType; - + typedef otb::WaveletOperator<wvltID, otb::Wavelet::INVERSE, PixelType, Dimension> + InverseWaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, InverseWaveletOperator, otb::Wavelet::INVERSE> + InverseFilterBank; + typedef otb::WaveletTransform<ImageType, ImageType, InverseFilterBank, otb::Wavelet::INVERSE> + InvFilterType; + InvFilterType::Pointer invFilter = InvFilterType::New(); - invFilter->SetInput( filter->GetOutput() ); - invFilter->SetSubsampleImageFactor( decimFactor ); + invFilter->SetInput(filter->GetOutput()); + invFilter->SetSubsampleImageFactor(decimFactor); invFilter->Update(); /* Writing the output */ typedef otb::ImageFileWriter<ImageType> WriterType; WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFileName ); - writer->SetInput( invFilter->GetOutput() ); + writer->SetFileName(outputFileName); + writer->SetInput(invFilter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/MultiScale/otbWaveletTransformNew.cxx b/Testing/Code/MultiScale/otbWaveletTransformNew.cxx index 50115299cb..00c139c0a7 100644 --- a/Testing/Code/MultiScale/otbWaveletTransformNew.cxx +++ b/Testing/Code/MultiScale/otbWaveletTransformNew.cxx @@ -24,21 +24,20 @@ int otbWaveletTransformNew(int argc, char * argv[]) { const int Dimension = 2; - typedef double PixelType; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; /* Wavelet choice */ const otb::Wavelet::Wavelet wvltID = otb::Wavelet::SYMLET8; /* Forward Transformation */ - typedef otb::WaveletOperator< wvltID, otb::Wavelet::FORWARD, PixelType, Dimension > WaveletOperator; - typedef otb::WaveletFilterBank< ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD > - ForwardFilterBank; - typedef otb::WaveletTransform< ImageType, ImageType, ForwardFilterBank, otb::Wavelet::FORWARD > - FilterType; - + typedef otb::WaveletOperator<wvltID, otb::Wavelet::FORWARD, PixelType, Dimension> WaveletOperator; + typedef otb::WaveletFilterBank<ImageType, ImageType, WaveletOperator, otb::Wavelet::FORWARD> + ForwardFilterBank; + typedef otb::WaveletTransform<ImageType, ImageType, ForwardFilterBank, otb::Wavelet::FORWARD> + FilterType; + FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Projections/otbCompositeTransform.cxx b/Testing/Code/Projections/otbCompositeTransform.cxx index bbd4581316..2328f6e4a0 100644 --- a/Testing/Code/Projections/otbCompositeTransform.cxx +++ b/Testing/Code/Projections/otbCompositeTransform.cxx @@ -30,42 +30,40 @@ #include "otbMapProjections.h" #include "otbInverseSensorModel.h" -int otbCompositeTransform( int argc, char* argv[] ) +int otbCompositeTransform(int argc, char* argv[]) { - if (argc!=3) - { - std::cout << argv[0] <<" <input filename> <output filename>" + if (argc != 3) + { + std::cout << argv[0] << " <input filename> <output filename>" << std::endl; return EXIT_FAILURE; - } + } char * filename = argv[1]; char * outFilename = argv[2]; - - typedef otb::Image<double, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + typedef otb::Image<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(filename); reader->UpdateOutputInformation(); typedef otb::UtmInverseProjection MapProjectionType; - int utmZone = 31; + int utmZone = 31; char utmHemisphere = 'N'; MapProjectionType::Pointer mapProjection = MapProjectionType::New(); mapProjection->SetZone(utmZone); mapProjection->SetHemisphere(utmHemisphere); - - typedef otb::InverseSensorModel<double> SensorModelType; + typedef otb::InverseSensorModel<double> SensorModelType; SensorModelType::Pointer sensorModel = SensorModelType::New(); sensorModel->SetImageGeometry(reader->GetOutput()->GetImageKeywordlist()); - typedef otb::CompositeTransform< MapProjectionType,SensorModelType> CompositeTransformType; + typedef otb::CompositeTransform<MapProjectionType, SensorModelType> CompositeTransformType; CompositeTransformType::Pointer compositeTransform = CompositeTransformType::New(); compositeTransform->SetFirstTransform(mapProjection); @@ -75,17 +73,14 @@ int otbCompositeTransform( int argc, char* argv[] ) file.open(outFilename); file << std::setprecision(15); - itk::Point<double,2> point; - point[0]=374100; - point[1]=4829000; + itk::Point<double, 2> point; + point[0] = 374100; + point[1] = 4829000; file << "Standard Composite transform: " << std::endl; file << point << " -> "; file << compositeTransform->TransformPoint(point); file << std::endl << std::endl; - file.close(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbCompositeTransformNew.cxx b/Testing/Code/Projections/otbCompositeTransformNew.cxx index bb593fa8ef..cd1fb60d84 100644 --- a/Testing/Code/Projections/otbCompositeTransformNew.cxx +++ b/Testing/Code/Projections/otbCompositeTransformNew.cxx @@ -27,15 +27,13 @@ #include "otbMapProjections.h" #include "otbInverseSensorModel.h" -int otbCompositeTransformNew( int argc, char* argv[] ) +int otbCompositeTransformNew(int argc, char* argv[]) { - typedef otb::UtmInverseProjection MapProjectionType; - typedef otb::InverseSensorModel<double> SensorModelType; + typedef otb::UtmInverseProjection MapProjectionType; + typedef otb::InverseSensorModel<double> SensorModelType; - typedef otb::CompositeTransform< MapProjectionType,SensorModelType> CompositeTransformType; + typedef otb::CompositeTransform<MapProjectionType, SensorModelType> CompositeTransformType; CompositeTransformType::Pointer compositeTransform = CompositeTransformType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbCreateInverseForwardSensorModel.cxx b/Testing/Code/Projections/otbCreateInverseForwardSensorModel.cxx index de02da45c1..ddfb25301e 100644 --- a/Testing/Code/Projections/otbCreateInverseForwardSensorModel.cxx +++ b/Testing/Code/Projections/otbCreateInverseForwardSensorModel.cxx @@ -43,15 +43,15 @@ #include "init/ossimInit.h" -int otbCreateInverseForwardSensorModel( int argc, char* argv[] ) +int otbCreateInverseForwardSensorModel(int argc, char* argv[]) { ossimInit::instance()->initialize(argc, argv); - if (argc!=2) - { - std::cout << argv[0] <<" <input filename>" << std::endl; + if (argc != 2) + { + std::cout << argv[0] << " <input filename>" << std::endl; return EXIT_FAILURE; - } + } typedef otb::Image<unsigned int, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; @@ -59,9 +59,9 @@ int otbCreateInverseForwardSensorModel( int argc, char* argv[] ) typedef otb::ForwardSensorModel<double> ForwardModelType; //Allocate pointer - InverseModelType::Pointer inverse_model= InverseModelType::New(); - ForwardModelType::Pointer forward_model= ForwardModelType::New(); - ReaderType::Pointer reader=ReaderType::New(); + InverseModelType::Pointer inverse_model = InverseModelType::New(); + ForwardModelType::Pointer forward_model = ForwardModelType::New(); + ReaderType::Pointer reader = ReaderType::New(); // Set parameters ... reader->SetFileName(argv[1]); @@ -71,11 +71,10 @@ int otbCreateInverseForwardSensorModel( int argc, char* argv[] ) ImageType::Pointer inputImage = reader->GetOutput(); //Leve une exception si le model n'est pas créé - otbGenericMsgDebugMacro(<< "Inverse model creation..." ); + otbGenericMsgDebugMacro(<< "Inverse model creation..."); inverse_model->SetImageGeometry(inputImage->GetImageKeywordlist()); - otbGenericMsgDebugMacro(<< "Foreward model creation..." ); + otbGenericMsgDebugMacro(<< "Foreward model creation..."); forward_model->SetImageGeometry(inputImage->GetImageKeywordlist()); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Projections/otbCreateProjectionWithOSSIM.cxx b/Testing/Code/Projections/otbCreateProjectionWithOSSIM.cxx index 0e6014b77a..4ade00e765 100644 --- a/Testing/Code/Projections/otbCreateProjectionWithOSSIM.cxx +++ b/Testing/Code/Projections/otbCreateProjectionWithOSSIM.cxx @@ -39,7 +39,6 @@ #include "otbImageFileWriter.h" #include "otbStreamingImageFileWriter.h" - #include "itkExceptionObject.h" #include "itkExtractImageFilter.h" #include "itkRescaleIntensityImageFilter.h" @@ -52,48 +51,44 @@ // without this all the important factories are not created. //#include "init/ossimInit.h" - -int otbCreateProjectionWithOSSIM( int argc, char* argv[] ) +int otbCreateProjectionWithOSSIM(int argc, char* argv[]) { ossimInit::instance()->initialize(argc, argv); - if (argc!=2) - { - std::cout << argv[0] <<" <input filename> " << std::endl; + if (argc != 2) + { + std::cout << argv[0] << " <input filename> " << std::endl; return EXIT_FAILURE; - } - + } - otbGenericMsgDebugMacro(<< "Creating handler..." ); + otbGenericMsgDebugMacro(<< "Creating handler..."); ossimImageHandler *handler = ossimImageHandlerRegistry::instance()->open(ossimFilename(argv[1])); if (!handler) - { - itkGenericExceptionMacro(<<"Unable to open input image "<<argv[1]); - } + { + itkGenericExceptionMacro(<< "Unable to open input image " << argv[1]); + } ossimKeywordlist geom; - otbGenericMsgDebugMacro(<< "Read ossim Keywordlist..." ); + otbGenericMsgDebugMacro(<< "Read ossim Keywordlist..."); handler->getImageGeometry()->getProjection()->saveState(geom); - ossimGpt ossimGPoint(0,0); + ossimGpt ossimGPoint(0, 0); ossimDpt ossimDPoint; - otbGenericMsgDebugMacro(<< "Creating projection..." ); + otbGenericMsgDebugMacro(<< "Creating projection..."); ossimProjection * model = NULL; model = ossimProjectionFactoryRegistry::instance()->createProjection(geom); - if ( model == NULL) - { - itkGenericExceptionMacro(<<"Invalid Model * == NULL !"); - } + if (model == NULL) + { + itkGenericExceptionMacro(<< "Invalid Model * == NULL !"); + } - otbGenericMsgDebugMacro(<< "Creating RefPtr of projection..." ); + otbGenericMsgDebugMacro(<< "Creating RefPtr of projection..."); ossimRefPtr<ossimProjection> ptrmodel = model; - if ( ptrmodel.valid() == false ) - { - itkGenericExceptionMacro(<<"Invalid Model pointer .valid() == false !"); - } - + if (ptrmodel.valid() == false) + { + itkGenericExceptionMacro(<< "Invalid Model pointer .valid() == false !"); + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/Projections/otbCreateProjectionWithOTB.cxx b/Testing/Code/Projections/otbCreateProjectionWithOTB.cxx index 0bdc40a34e..354f2a035c 100644 --- a/Testing/Code/Projections/otbCreateProjectionWithOTB.cxx +++ b/Testing/Code/Projections/otbCreateProjectionWithOTB.cxx @@ -39,7 +39,6 @@ #include "otbImageFileWriter.h" #include "otbStreamingImageFileWriter.h" - #include "itkExceptionObject.h" #include "itkExtractImageFilter.h" #include "itkRescaleIntensityImageFilter.h" @@ -52,33 +51,32 @@ // without this all the important factories are not created. //#include "init/ossimInit.h" - -int otbCreateProjectionWithOTB( int argc, char* argv[] ) +int otbCreateProjectionWithOTB(int argc, char* argv[]) { ossimInit::instance()->initialize(argc, argv); - if (argc!=2) - { - std::cout << argv[0] <<" <input filename> " << std::endl; + if (argc != 2) + { + std::cout << argv[0] << " <input filename> " << std::endl; return EXIT_FAILURE; - } + } typedef otb::Image<unsigned int, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader=ReaderType::New(); + typedef otb::ImageFileReader<ImageType> ReaderType; + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); //Read meta data (ossimKeywordlist) reader->GenerateOutputInformation(); - otbGenericMsgDebugMacro(<< "Read ossim Keywordlist..." ); + otbGenericMsgDebugMacro(<< "Read ossim Keywordlist..."); otb::ImageKeywordlist otb_image_keywordlist = reader->GetOutput()->GetImageKeywordlist(); ossimKeywordlist geom; otb_image_keywordlist.convertToOSSIMKeywordlist(geom); - otbGenericMsgDebugMacro(<< "ossim Keywordlist:"<<geom ); + otbGenericMsgDebugMacro(<< "ossim Keywordlist:" << geom); /* typedef otb::InverseSensorModel<double> ModelType; @@ -91,25 +89,23 @@ int otbCreateProjectionWithOTB( int argc, char* argv[] ) return 1; } */ - ossimGpt ossimGPoint(0,0); - ossimDpt ossimDPoint; + ossimGpt ossimGPoint(0, 0); + ossimDpt ossimDPoint; ossimProjection * model = NULL; - otbGenericMsgDebugMacro(<< "Creating projection..." ); + otbGenericMsgDebugMacro(<< "Creating projection..."); model = ossimProjectionFactoryRegistry::instance()->createProjection(geom); - if ( model == NULL) - { - itkGenericExceptionMacro(<<"Invalid Model * == NULL !"); - } + if (model == NULL) + { + itkGenericExceptionMacro(<< "Invalid Model * == NULL !"); + } - otbGenericMsgDebugMacro(<< "Creating RefPtr of projection..." ); + otbGenericMsgDebugMacro(<< "Creating RefPtr of projection..."); ossimRefPtr<ossimProjection> ptrmodel = model; - if ( ptrmodel.valid() == false ) - { - itkGenericExceptionMacro(<<"Invalid Model pointer .valid() == false !"); - } - + if (ptrmodel.valid() == false) + { + itkGenericExceptionMacro(<< "Invalid Model pointer .valid() == false !"); + } return EXIT_SUCCESS; } - diff --git a/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterNew.cxx b/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterNew.cxx index 1d457cd499..ee33f24479 100644 --- a/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterNew.cxx +++ b/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterNew.cxx @@ -20,15 +20,14 @@ #include "otbImage.h" #include "otbGCPsToRPCSensorModelImageFilter.h" -int otbGCPsToRPCSensorModelImageFilterNew( int argc, char* argv[] ) +int otbGCPsToRPCSensorModelImageFilterNew(int argc, char* argv[]) { typedef otb::Image<float, 2> ImageType; typedef otb::GCPsToRPCSensorModelImageFilter<ImageType> GCPToSensorModelFilterType; - + // Instantiation GCPToSensorModelFilterType::Pointer filter = GCPToSensorModelFilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterWithoutDEM.cxx b/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterWithoutDEM.cxx index dd868f1a62..03e909eb65 100644 --- a/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterWithoutDEM.cxx +++ b/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterWithoutDEM.cxx @@ -20,16 +20,16 @@ #include "otbImageFileReader.h" #include "otbGCPsToRPCSensorModelImageFilter.h" -int otbGCPsToRPCSensorModelImageFilterWithoutDEM( int argc, char* argv[] ) +int otbGCPsToRPCSensorModelImageFilterWithoutDEM(int argc, char* argv[]) { - if(argc < 3 ) + if (argc < 3) { - std::cerr<<"Usage: "<<argv[0]<<" infname outfname a1x a1y b1x b1y b1z ... aNx aNy bNx bNy bNz"<<std::endl; + std::cerr << "Usage: " << argv[0] << " infname outfname a1x a1y b1x b1y b1z ... aNx aNy bNx bNy bNz" << std::endl; return EXIT_FAILURE; } - else if((argc-3)%5 != 0) + else if ((argc - 3) % 5 != 0) { - std::cerr<<"Inconsistent GCPs description!"<<std::endl; + std::cerr << "Inconsistent GCPs description!" << std::endl; return EXIT_FAILURE; } @@ -48,24 +48,24 @@ int otbGCPsToRPCSensorModelImageFilterWithoutDEM( int argc, char* argv[] ) GCPsToSensorModelFilterType::Pointer rpcEstimator = GCPsToSensorModelFilterType::New(); rpcEstimator->SetInput(reader->GetOutput()); - unsigned int nbGCPs = (argc-3)/5; - - std::cout<<"Receiving "<<nbGCPs<<" from command line."<<std::endl; + unsigned int nbGCPs = (argc - 3) / 5; - for(unsigned int gcpId = 0;gcpId<nbGCPs;++gcpId) + std::cout << "Receiving " << nbGCPs << " from command line." << std::endl; + + for (unsigned int gcpId = 0; gcpId < nbGCPs; ++gcpId) { Point2DType sensorPoint; - sensorPoint[0] = atof(argv[3+gcpId*5]); - sensorPoint[1] = atof(argv[4+gcpId*5]); + sensorPoint[0] = atof(argv[3 + gcpId * 5]); + sensorPoint[1] = atof(argv[4 + gcpId * 5]); Point3DType geoPoint; - geoPoint[0] = atof(argv[5+5*gcpId]); - geoPoint[1] = atof(argv[6+5*gcpId]); - geoPoint[2] = atof(argv[7+5*gcpId]); - - std::cout<<"Adding GCP sensor: "<<sensorPoint<<" <-> geo: "<<geoPoint<<std::endl; + geoPoint[0] = atof(argv[5 + 5 * gcpId]); + geoPoint[1] = atof(argv[6 + 5 * gcpId]); + geoPoint[2] = atof(argv[7 + 5 * gcpId]); + + std::cout << "Adding GCP sensor: " << sensorPoint << " <-> geo: " << geoPoint << std::endl; - rpcEstimator->AddGCP(sensorPoint,geoPoint); + rpcEstimator->AddGCP(sensorPoint, geoPoint); } rpcEstimator->GetOutput()->UpdateOutputInformation(); @@ -77,8 +77,8 @@ int otbGCPsToRPCSensorModelImageFilterWithoutDEM( int argc, char* argv[] ) ofs.setf(ios::fixed, ios::floatfield); ofs.precision(10); - ofs<<rpcEstimator->GetOutput()->GetImageKeywordlist()<<std::endl; - ofs<<"Residual ground error: "<<rpcEstimator->GetRMSGroundError()<<std::endl; + ofs << rpcEstimator->GetOutput()->GetImageKeywordlist() << std::endl; + ofs << "Residual ground error: " << rpcEstimator->GetRMSGroundError() << std::endl; ofs.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/Projections/otbGenericMapProjection.cxx b/Testing/Code/Projections/otbGenericMapProjection.cxx index 02f486a62d..880f84c5ad 100644 --- a/Testing/Code/Projections/otbGenericMapProjection.cxx +++ b/Testing/Code/Projections/otbGenericMapProjection.cxx @@ -20,25 +20,26 @@ #include "otbImage.h" #include "otbGenericMapProjection.h" -int otbGenericMapProjection( int argc, char* argv[] ) +int otbGenericMapProjection(int argc, char* argv[]) { - const char * outFileName = argv[1]; + const char * outFileName = argv[1]; std::ofstream file; file.open(outFileName); file << std::setprecision(15); /** Test the ability to instanciate a projection from a string*/ - std::string projectionRefWkt ="PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; + std::string projectionRefWkt = + "PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; typedef otb::GenericMapProjection<otb::FORWARD> GenericMapProjection; GenericMapProjection::Pointer genericMapProjection = GenericMapProjection::New(); genericMapProjection->SetWkt(projectionRefWkt); file << genericMapProjection->GetWkt() << std::endl << std::endl; - itk::Point<double,2> point; - point[0]=1.44; - point[1]=43.6050; + itk::Point<double, 2> point; + point[0] = 1.44; + point[1] = 43.6050; file << "Forward projection: " << std::endl; file << point << " -> "; file << genericMapProjection->TransformPoint(point); @@ -49,8 +50,8 @@ int otbGenericMapProjection( int argc, char* argv[] ) genericMapProjectionInverse->SetWkt(projectionRefWkt); file << genericMapProjectionInverse->GetWkt() << std::endl << std::endl; - point[0]=374100.8; - point[1]=4829184.8; + point[0] = 374100.8; + point[1] = 4829184.8; file << "Inverse projection: " << std::endl; file << point << " -> "; file << genericMapProjectionInverse->TransformPoint(point); diff --git a/Testing/Code/Projections/otbGenericMapProjectionNew.cxx b/Testing/Code/Projections/otbGenericMapProjectionNew.cxx index 55ed9d51ce..0205122b53 100644 --- a/Testing/Code/Projections/otbGenericMapProjectionNew.cxx +++ b/Testing/Code/Projections/otbGenericMapProjectionNew.cxx @@ -25,15 +25,11 @@ #include "otbGenericMapProjection.h" - -int otbGenericMapProjectionNew( int argc, char* argv[] ) +int otbGenericMapProjectionNew(int argc, char* argv[]) { typedef otb::GenericMapProjection<otb::FORWARD> MapProjectionType; MapProjectionType::Pointer mapProjection = MapProjectionType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbGenericRSTransform.cxx b/Testing/Code/Projections/otbGenericRSTransform.cxx index ae0ee24645..bd4201fe11 100644 --- a/Testing/Code/Projections/otbGenericRSTransform.cxx +++ b/Testing/Code/Projections/otbGenericRSTransform.cxx @@ -23,11 +23,11 @@ #include <ogr_spatialref.h> #include <fstream> -int otbGenericRSTransform( int argc, char* argv[] ) +int otbGenericRSTransform(int argc, char* argv[]) { OGRSpatialReference oSRS; - typedef otb::GenericRSTransform<> TransformType; + typedef otb::GenericRSTransform<> TransformType; typedef TransformType::InputPointType PointType; PointType geoPoint; @@ -36,7 +36,6 @@ int otbGenericRSTransform( int argc, char* argv[] ) geoPoint[1] = atof(argv[2]); const char * outfname = argv[3]; - // Build wgs ref oSRS.SetWellKnownGeogCS("WGS84"); char * wgsRef = NULL; @@ -44,10 +43,9 @@ int otbGenericRSTransform( int argc, char* argv[] ) // Build UTM ref oSRS.SetProjCS("UTM"); - oSRS.SetUTM(31,true); + oSRS.SetUTM(31, true); char * utmRef = NULL; oSRS.exportToWkt(&utmRef); - // Build Lambert II ref double stdParallel1 = 45.89891944; @@ -57,7 +55,7 @@ int otbGenericRSTransform( int argc, char* argv[] ) double falseEastingL2 = 600000; double falseNorthingL2 = 2200000; oSRS.SetProjCS("Lambert II "); - oSRS.SetLCC(stdParallel1,stdParallel2,originLatL2,originLongL2,falseEastingL2,falseNorthingL2); + oSRS.SetLCC(stdParallel1, stdParallel2, originLatL2, originLongL2, falseEastingL2, falseNorthingL2); char * lambertRef = NULL; oSRS.exportToWkt(&lambertRef); @@ -65,10 +63,9 @@ int otbGenericRSTransform( int argc, char* argv[] ) double originLatTmt = 49.83; double originLongTmt = 6.16; - oSRS.SetProjCS("Transmercator "); oSRS.SetWellKnownGeogCS("WGS84"); - oSRS.SetTM(originLatTmt,originLongTmt,1,0,0); + oSRS.SetTM(originLatTmt, originLongTmt, 1, 0, 0); char * tmtRef = NULL; oSRS.exportToWkt(&tmtRef); @@ -140,7 +137,6 @@ int otbGenericRSTransform( int argc, char* argv[] ) TransformType::Pointer tmt2lambert = TransformType::New(); lambert2tmt->GetInverse(tmt2lambert); - ofstream ofs; ofs.open(outfname); @@ -148,10 +144,10 @@ int otbGenericRSTransform( int argc, char* argv[] ) ofs.setf(ios::fixed, ios::floatfield); ofs.precision(10); - ofs<<"Testing geopoint: "<<geoPoint<<std::endl<<std::endl; + ofs << "Testing geopoint: " << geoPoint << std::endl << std::endl; + + ofs << "Testing wgs84 to wgs84: " << geoPoint << " -> " << wgs2wgs->TransformPoint(geoPoint) << std::endl; - ofs<<"Testing wgs84 to wgs84: "<<geoPoint<<" -> "<<wgs2wgs->TransformPoint(geoPoint)<<std::endl; - PointType utmPoint, lambertPoint, tmtPoint; utmPoint = wgs2utm->TransformPoint(geoPoint); @@ -160,53 +156,58 @@ int otbGenericRSTransform( int argc, char* argv[] ) ofs.precision(3); - ofs<<"Testing utm 31 north to utm 31 north: "<<utmPoint<<" -> "<<utm2utm->TransformPoint(utmPoint)<<std::endl; - ofs<<"Testing lambert 2 to lambert 2: "<<lambertPoint<<" -> "<<lambert2lambert->TransformPoint(lambertPoint)<<std::endl; - ofs<<"Testing transmercator 31 north to transmercator: "<<tmtPoint<<" -> "<<tmt2tmt->TransformPoint(tmtPoint)<<std::endl; + ofs << "Testing utm 31 north to utm 31 north: " << utmPoint << " -> " << utm2utm->TransformPoint(utmPoint) << + std::endl; + ofs << "Testing lambert 2 to lambert 2: " << lambertPoint << " -> " << + lambert2lambert->TransformPoint(lambertPoint) << std::endl; + ofs << "Testing transmercator 31 north to transmercator: " << tmtPoint << " -> " << + tmt2tmt->TransformPoint(tmtPoint) << std::endl; - ofs<<std::endl<<"Testing geo 2 carto ..."<<std::endl<<std::endl; + ofs << std::endl << "Testing geo 2 carto ..." << std::endl << std::endl; ofs.precision(10); - ofs<<"Testing wgs84 to utm 31 north: "<<geoPoint; + ofs << "Testing wgs84 to utm 31 north: " << geoPoint; ofs.precision(3); - ofs<<" -> "<<utmPoint<<std::endl; - ofs<<"Testing utm 31 north to wgs84: "<<utmPoint; + ofs << " -> " << utmPoint << std::endl; + ofs << "Testing utm 31 north to wgs84: " << utmPoint; ofs.precision(10); - ofs<<" -> "<<utm2wgs->TransformPoint(utmPoint)<<std::endl; + ofs << " -> " << utm2wgs->TransformPoint(utmPoint) << std::endl; - ofs<<"Testing wgs84 to lambert 2: "<<geoPoint; + ofs << "Testing wgs84 to lambert 2: " << geoPoint; ofs.precision(3); - ofs<<" -> "<<lambertPoint<<std::endl; - ofs<<"Testing lambert 2 to wgs84: "<<lambertPoint; + ofs << " -> " << lambertPoint << std::endl; + ofs << "Testing lambert 2 to wgs84: " << lambertPoint; ofs.precision(10); - ofs<<" -> "<<lambert2wgs->TransformPoint(lambertPoint)<<std::endl; - - ofs<<"Testing wgs84 to transmeractor: "<<geoPoint; + ofs << " -> " << lambert2wgs->TransformPoint(lambertPoint) << std::endl; + + ofs << "Testing wgs84 to transmeractor: " << geoPoint; ofs.precision(3); - ofs<<" -> "<<tmtPoint<<std::endl; - ofs<<"Testing transmercator to wgs84: "<<tmtPoint; + ofs << " -> " << tmtPoint << std::endl; + ofs << "Testing transmercator to wgs84: " << tmtPoint; ofs.precision(10); - ofs<<" -> "<<tmt2wgs->TransformPoint(tmtPoint)<<std::endl; + ofs << " -> " << tmt2wgs->TransformPoint(tmtPoint) << std::endl; - - ofs<<std::endl<<"Testing cross geo ..."<<std::endl<<std::endl; + ofs << std::endl << "Testing cross geo ..." << std::endl << std::endl; ofs.precision(3); - ofs<<"Testing lambert 2 to utm 31 north: "<<lambertPoint<<" -> "<<lambert2utm->TransformPoint(lambertPoint)<<std::endl; - ofs<<"Testing utm 31 north to lambert 2: "<<utmPoint<<" -> "<<utm2lambert->TransformPoint(utmPoint)<<std::endl; - - ofs<<"Testing lambert 2 to transmercator: "<<lambertPoint<<" -> "<<lambert2tmt->TransformPoint(lambertPoint)<<std::endl; - ofs<<"Testing transmercator to lambert 2: "<<tmtPoint<<" -> "<<tmt2lambert->TransformPoint(tmtPoint)<<std::endl; + ofs << "Testing lambert 2 to utm 31 north: " << lambertPoint << " -> " << + lambert2utm->TransformPoint(lambertPoint) << std::endl; + ofs << "Testing utm 31 north to lambert 2: " << utmPoint << " -> " << utm2lambert->TransformPoint(utmPoint) << + std::endl; + + ofs << "Testing lambert 2 to transmercator: " << lambertPoint << " -> " << + lambert2tmt->TransformPoint(lambertPoint) << std::endl; + ofs << "Testing transmercator to lambert 2: " << tmtPoint << " -> " << tmt2lambert->TransformPoint(tmtPoint) << + std::endl; + ofs << "Testing transmercator to utm 31 north: " << tmtPoint << " -> " << tmt2utm->TransformPoint(tmtPoint) << + std::endl; + ofs << "Testing utm 31 north to transmercator: " << utmPoint << " -> " << utm2tmt->TransformPoint(utmPoint) << + std::endl; - ofs<<"Testing transmercator to utm 31 north: "<<tmtPoint<<" -> "<<tmt2utm->TransformPoint(tmtPoint)<<std::endl; - ofs<<"Testing utm 31 north to transmercator: "<<utmPoint<<" -> "<<utm2tmt->TransformPoint(utmPoint)<<std::endl; - ofs.close(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbGenericRSTransformNew.cxx b/Testing/Code/Projections/otbGenericRSTransformNew.cxx index 7a04344a0a..c950ace480 100644 --- a/Testing/Code/Projections/otbGenericRSTransformNew.cxx +++ b/Testing/Code/Projections/otbGenericRSTransformNew.cxx @@ -25,15 +25,11 @@ #include "otbGenericRSTransform.h" - -int otbGenericRSTransformNew( int argc, char* argv[] ) +int otbGenericRSTransformNew(int argc, char* argv[]) { typedef otb::GenericRSTransform<> TransformType; TransformType::Pointer transform = TransformType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbGeocentricTransform.cxx b/Testing/Code/Projections/otbGeocentricTransform.cxx index 41b9397501..d64ad5e3c0 100644 --- a/Testing/Code/Projections/otbGeocentricTransform.cxx +++ b/Testing/Code/Projections/otbGeocentricTransform.cxx @@ -23,9 +23,9 @@ #include "otbImage.h" #include "otbGeocentricTransform.h" -int otbGeocentricTransform( int argc, char* argv[] ) +int otbGeocentricTransform(int argc, char* argv[]) { - const char * outFileName = argv[1]; + const char * outFileName = argv[1]; std::ofstream file; file.open(outFileName); @@ -34,19 +34,19 @@ int otbGeocentricTransform( int argc, char* argv[] ) file << std::setprecision(15); file << "Forward projection: " << std::endl; - itk::Point<double,3> point; - point[0]=0;//lon - point[1]=0;//lat - point[2]=0;//elev + itk::Point<double, 3> point; + point[0] = 0; //lon + point[1] = 0; //lat + point[2] = 0; //elev file << point << " -> "; file << projection->TransformPoint(point); file << std::endl << std::endl; // itk::Point<double,3> point; - point[0]=1.4835345f;//lon - point[1]=43.559682611111107f;//lat - point[2]=192.15;//elev + point[0] = 1.4835345f; //lon + point[1] = 43.559682611111107f; //lat + point[2] = 192.15; //elev file << point << " -> "; file << projection->TransformPoint(point); @@ -57,9 +57,9 @@ int otbGeocentricTransform( int argc, char* argv[] ) file << "Inverse projection: " << std::endl; - point[0]=3771793.97;//X - point[1]=140253.34;//Y - point[2]=5124421.30;//Z + point[0] = 3771793.97; //X + point[1] = 140253.34; //Y + point[2] = 5124421.30; //Z file << point << " -> "; file << inverseProjection->TransformPoint(point); diff --git a/Testing/Code/Projections/otbGeocentricTransformNew.cxx b/Testing/Code/Projections/otbGeocentricTransformNew.cxx index 222a34ee94..63412adf21 100644 --- a/Testing/Code/Projections/otbGeocentricTransformNew.cxx +++ b/Testing/Code/Projections/otbGeocentricTransformNew.cxx @@ -23,13 +23,12 @@ #include "otbImage.h" #include "otbGeocentricTransform.h" -int otbGeocentricTransformNew( int argc, char* argv[] ) +int otbGeocentricTransformNew(int argc, char* argv[]) { typedef otb::GeocentricTransform<otb::FORWARD> ProjectionType; ProjectionType::Pointer projection = ProjectionType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Projections/otbLeastSquareAffineTransformEstimator.cxx b/Testing/Code/Projections/otbLeastSquareAffineTransformEstimator.cxx index 181ae9c338..861d96e600 100644 --- a/Testing/Code/Projections/otbLeastSquareAffineTransformEstimator.cxx +++ b/Testing/Code/Projections/otbLeastSquareAffineTransformEstimator.cxx @@ -23,51 +23,51 @@ #include "otbLeastSquareAffineTransformEstimator.h" #include "itkPoint.h" -int otbLeastSquareAffineTransformEstimator( int argc, char* argv[] ) +int otbLeastSquareAffineTransformEstimator(int argc, char* argv[]) { - if(argc < 8) + if (argc < 8) { - std::cerr<<"Usage: "<<argv[0]<<" outfname a1x a1y a1z b1x b1y b1z ... aNx aNy aNz bNx bNy bNz"<<std::endl; + std::cerr << "Usage: " << argv[0] << " outfname a1x a1y a1z b1x b1y b1z ... aNx aNy aNz bNx bNy bNz" << std::endl; return EXIT_FAILURE; } - - if((argc-2) % 6 != 0) + + if ((argc - 2) % 6 != 0) { - std::cerr<<"Inconsistent points description."<<std::endl; + std::cerr << "Inconsistent points description." << std::endl; return EXIT_FAILURE; } const char * outfname = argv[1]; - typedef itk::Point<float,3> PointType; + typedef itk::Point<float, 3> PointType; typedef otb::LeastSquareAffineTransformEstimator<PointType> EstimatorType; - + // instantiation EstimatorType::Pointer estimator = EstimatorType::New(); // nb points - unsigned int nbTiePoints = (argc-2) / 6; + unsigned int nbTiePoints = (argc - 2) / 6; - std::cout<<"Reading "<<nbTiePoints<<" tie points from command line."<<std::endl; + std::cout << "Reading " << nbTiePoints << " tie points from command line." << std::endl; - for(unsigned int pId = 0; pId < nbTiePoints; ++pId) + for (unsigned int pId = 0; pId < nbTiePoints; ++pId) { PointType p1, p2; // Reading first point - p1[0] = atof(argv[2+pId*6]); - p1[1] = atof(argv[3+pId*6]); - p1[2] = atof(argv[4+pId*6]); + p1[0] = atof(argv[2 + pId * 6]); + p1[1] = atof(argv[3 + pId * 6]); + p1[2] = atof(argv[4 + pId * 6]); // Reading second point - p2[0] = atof(argv[5+pId*6]); - p2[1] = atof(argv[6+pId*6]); - p2[2] = atof(argv[7+pId*6]); + p2[0] = atof(argv[5 + pId * 6]); + p2[1] = atof(argv[6 + pId * 6]); + p2[2] = atof(argv[7 + pId * 6]); - std::cout<<"Adding tie points "<<p1<<" <-> "<<p2<<std::endl; + std::cout << "Adding tie points " << p1 << " <-> " << p2 << std::endl; // Add it to the estimator - estimator->AddTiePoints(p1,p2); + estimator->AddTiePoints(p1, p2); } // Trigger computation @@ -80,14 +80,14 @@ int otbLeastSquareAffineTransformEstimator( int argc, char* argv[] ) ofs.setf(std::ios::fixed, std::ios::floatfield); ofs.precision(10); - ofs<<"Estimated affine matrix: "<<std::endl; - ofs<<estimator->GetMatrix()<<std::endl; - ofs<<"Estimated affine offset: "<<std::endl; - ofs<<estimator->GetOffset()<<std::endl; - ofs<<"RMS error: "<<std::endl; - ofs<<estimator->GetRMSError()<<std::endl; - ofs<<"Relative residual: "<<std::endl; - ofs<<estimator->GetRelativeResidual()<<std::endl; + ofs << "Estimated affine matrix: " << std::endl; + ofs << estimator->GetMatrix() << std::endl; + ofs << "Estimated affine offset: " << std::endl; + ofs << estimator->GetOffset() << std::endl; + ofs << "RMS error: " << std::endl; + ofs << estimator->GetRMSError() << std::endl; + ofs << "Relative residual: " << std::endl; + ofs << estimator->GetRelativeResidual() << std::endl; ofs.close(); // Testing the GetTiePointsContainer() method @@ -98,4 +98,3 @@ int otbLeastSquareAffineTransformEstimator( int argc, char* argv[] ) return EXIT_SUCCESS; } - diff --git a/Testing/Code/Projections/otbLeastSquareAffineTransformEstimatorNew.cxx b/Testing/Code/Projections/otbLeastSquareAffineTransformEstimatorNew.cxx index 2e5bddc6a9..bfecc0ba5f 100644 --- a/Testing/Code/Projections/otbLeastSquareAffineTransformEstimatorNew.cxx +++ b/Testing/Code/Projections/otbLeastSquareAffineTransformEstimatorNew.cxx @@ -20,15 +20,14 @@ #include "otbLeastSquareAffineTransformEstimator.h" #include "itkPoint.h" -int otbLeastSquareAffineTransformEstimatorNew( int argc, char* argv[] ) +int otbLeastSquareAffineTransformEstimatorNew(int argc, char* argv[]) { typedef itk::Point<float, 2> PointType; typedef otb::LeastSquareAffineTransformEstimator<PointType> EstimatorType; - + // instantiation EstimatorType::Pointer estimator = EstimatorType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Projections/otbMapProjection.cxx b/Testing/Code/Projections/otbMapProjection.cxx index f5bc901eba..8ed1ae923a 100644 --- a/Testing/Code/Projections/otbMapProjection.cxx +++ b/Testing/Code/Projections/otbMapProjection.cxx @@ -20,13 +20,12 @@ #include "otbImage.h" #include "otbMapProjections.h" -int otbMapProjection( int argc, char* argv[] ) +int otbMapProjection(int argc, char* argv[]) { - const char * outFileName = argv[1]; + const char * outFileName = argv[1]; std::ofstream file; file.open(outFileName); - /** Test the output of the projection in Wkt format*/ otb::UtmInverseProjection::Pointer lUtmProjection = otb::UtmInverseProjection::New(); file << lUtmProjection->GetWkt() << std::endl << std::endl; @@ -46,7 +45,6 @@ int otbMapProjection( int argc, char* argv[] ) otb::Lambert93ForwardProjection::Pointer lLambert93_2 = otb::Lambert93ForwardProjection::New(); file << lLambert93_2->GetWkt() << std::endl << std::endl; - otb::MercatorInverseProjection::Pointer lMercatorProjection = otb::MercatorInverseProjection::New(); file << lMercatorProjection->GetWkt() << std::endl << std::endl; diff --git a/Testing/Code/Projections/otbMapProjectionsNew.cxx b/Testing/Code/Projections/otbMapProjectionsNew.cxx index 33de04291f..5785c7bb57 100644 --- a/Testing/Code/Projections/otbMapProjectionsNew.cxx +++ b/Testing/Code/Projections/otbMapProjectionsNew.cxx @@ -25,75 +25,91 @@ #include "otbMapProjections.h" -int otbMapProjectionsNew( int argc, char* argv[] ) +int otbMapProjectionsNew(int argc, char* argv[]) { - otb::AlbersInverseProjection::Pointer lAlbersProjection = otb::AlbersInverseProjection::New(); - otb::AlbersForwardProjection::Pointer lAlbersProjection2 = otb::AlbersForwardProjection::New(); + otb::AlbersInverseProjection::Pointer lAlbersProjection = otb::AlbersInverseProjection::New(); + otb::AlbersForwardProjection::Pointer lAlbersProjection2 = otb::AlbersForwardProjection::New(); otb::AzimEquDistInverseProjection::Pointer lAzimEquDistProjection = otb::AzimEquDistInverseProjection::New(); otb::AzimEquDistForwardProjection::Pointer lAzimEquDistProjection2 = otb::AzimEquDistForwardProjection::New(); //Comment for OTB 2.2.0 because OSSIM error code -> generate Exception Fault on VS 7.1 only on Debug mode. // otb::BngInverseProjection::Pointer lBngProjection = otb::BngInverseProjection::New(); // otb::BngForwardProjection::Pointer lBngProjection2 = otb::BngForwardProjection::New(); - otb::BonneInverseProjection::Pointer lBonneProjection = otb::BonneInverseProjection::New(); - otb::BonneForwardProjection::Pointer lBonneProjection2 = otb::BonneForwardProjection::New(); - otb::CadrgInverseProjection::Pointer lCadrgProjection = otb::CadrgInverseProjection::New(); - otb::CadrgForwardProjection::Pointer lCadrgProjection2 = otb::CadrgForwardProjection::New(); - otb::CassiniInverseProjection::Pointer lCassiniProjection = otb::CassiniInverseProjection::New(); - otb::CassiniForwardProjection::Pointer lCassiniProjection2 = otb::CassiniForwardProjection::New(); - otb::CylEquAreaInverseProjection::Pointer lCylEquAreaProjection = otb::CylEquAreaInverseProjection::New(); - otb::CylEquAreaForwardProjection::Pointer lCylEquAreaProjection2 = otb::CylEquAreaForwardProjection::New(); - otb::Eckert4InverseProjection::Pointer lEckert4Projection = otb::Eckert4InverseProjection::New(); - otb::Eckert4ForwardProjection::Pointer lEckert4Projection2 = otb::Eckert4ForwardProjection::New(); - otb::Eckert6InverseProjection::Pointer lEckert6Projection = otb::Eckert6InverseProjection::New(); - otb::Eckert6ForwardProjection::Pointer lEckert6Projection2 = otb::Eckert6ForwardProjection::New(); - otb::GnomonicInverseProjection::Pointer lGnomonicProjection = otb::GnomonicInverseProjection::New(); - otb::GnomonicForwardProjection::Pointer lGnomonicProjection2 = otb::GnomonicForwardProjection::New(); - otb::LambertConformalConicInverseProjection::Pointer lLambertConformalConicProjection = otb::LambertConformalConicInverseProjection::New(); - otb::LambertConformalConicForwardProjection::Pointer lLambertConformalConicProjection2 = otb::LambertConformalConicForwardProjection::New(); - otb::LlxyInverseProjection::Pointer lLlxyProjection = otb::LlxyInverseProjection::New(); - otb::LlxyForwardProjection::Pointer lLlxyProjection2 = otb::LlxyForwardProjection::New(); - otb::EquDistCylInverseProjection::Pointer lEquDistCylProjection = otb::EquDistCylInverseProjection::New(); - otb::EquDistCylForwardProjection::Pointer lEquDistCylProjection2 = otb::EquDistCylForwardProjection::New(); - otb::MercatorInverseProjection::Pointer lMercatorProjection = otb::MercatorInverseProjection::New(); - otb::MercatorForwardProjection::Pointer lMercatorProjection2 = otb::MercatorForwardProjection::New(); - otb::MillerInverseProjection::Pointer lMillerProjection = otb::MillerInverseProjection::New(); - otb::MillerForwardProjection::Pointer lMillerProjection2 = otb::MillerForwardProjection::New(); - otb::MollweidInverseProjection::Pointer lMollweidProjection = otb::MollweidInverseProjection::New(); - otb::MollweidForwardProjection::Pointer lMollweidProjection2 = otb::MollweidForwardProjection::New(); - otb::NewZealandMapGridInverseProjection::Pointer lNewZealandMapGridProjection = otb::NewZealandMapGridInverseProjection::New(); - otb::NewZealandMapGridForwardProjection::Pointer lNewZealandMapGridProjection2 = otb::NewZealandMapGridForwardProjection::New(); - otb::ObliqueMercatorInverseProjection::Pointer lObliqueMercatorProjection = otb::ObliqueMercatorInverseProjection::New(); - otb::ObliqueMercatorForwardProjection::Pointer lObliqueMercatorProjection2 = otb::ObliqueMercatorForwardProjection::New(); - otb::OrthoGraphicInverseProjection::Pointer lOrthoGraphicProjection = otb::OrthoGraphicInverseProjection::New(); - otb::OrthoGraphicForwardProjection::Pointer lOrthoGraphicProjection2 = otb::OrthoGraphicForwardProjection::New(); - otb::PolarStereoInverseProjection::Pointer lPolarStereoProjection = otb::PolarStereoInverseProjection::New(); - otb::PolarStereoForwardProjection::Pointer lPolarStereoProjection2 = otb::PolarStereoForwardProjection::New(); - otb::PolyconicInverseProjection::Pointer lPolyconicProjection = otb::PolyconicInverseProjection::New(); - otb::PolyconicForwardProjection::Pointer lPolyconicProjection2 = otb::PolyconicForwardProjection::New(); - otb::SinusoidalInverseProjection::Pointer lSinusoidalProjection = otb::SinusoidalInverseProjection::New(); - otb::SinusoidalForwardProjection::Pointer lSinusoidalProjection2 = otb::SinusoidalForwardProjection::New(); - otb::SpaceObliqueMercatorInverseProjection::Pointer lSpaceObliqueMercatorProjection = otb::SpaceObliqueMercatorInverseProjection::New(); - otb::SpaceObliqueMercatorForwardProjection::Pointer lSpaceObliqueMercatorProjection2 = otb::SpaceObliqueMercatorForwardProjection::New(); - otb::StereographicInverseProjection::Pointer lStereographicProjection = otb::StereographicInverseProjection::New(); - otb::StereographicForwardProjection::Pointer lStereographicProjection2 = otb::StereographicForwardProjection::New(); - otb::TransCylEquAreaInverseProjection::Pointer lTransCylEquAreaProjection = otb::TransCylEquAreaInverseProjection::New(); - otb::TransCylEquAreaForwardProjection::Pointer lTransCylEquAreaProjection2 = otb::TransCylEquAreaForwardProjection::New(); - otb::TransMercatorInverseProjection::Pointer lTransMercatorProjection = otb::TransMercatorInverseProjection::New(); - otb::TransMercatorForwardProjection::Pointer lTransMercatorProjection2 = otb::TransMercatorForwardProjection::New(); - otb::UpsInverseProjection::Pointer lUpsProjection = otb::UpsInverseProjection::New(); - otb::UpsForwardProjection::Pointer lUpsProjection2 = otb::UpsForwardProjection::New(); - otb::UtmInverseProjection::Pointer lUtmProjection = otb::UtmInverseProjection::New(); - otb::UtmForwardProjection::Pointer lUtmProjection2 = otb::UtmForwardProjection::New(); - otb::VanDerGrintenInverseProjection::Pointer lVanDerGrintenProjection = otb::VanDerGrintenInverseProjection::New(); - otb::VanDerGrintenForwardProjection::Pointer lVanDerGrintenProjection2 = otb::VanDerGrintenForwardProjection::New(); + otb::BonneInverseProjection::Pointer lBonneProjection = otb::BonneInverseProjection::New(); + otb::BonneForwardProjection::Pointer lBonneProjection2 = otb::BonneForwardProjection::New(); + otb::CadrgInverseProjection::Pointer lCadrgProjection = otb::CadrgInverseProjection::New(); + otb::CadrgForwardProjection::Pointer lCadrgProjection2 = otb::CadrgForwardProjection::New(); + otb::CassiniInverseProjection::Pointer lCassiniProjection = otb::CassiniInverseProjection::New(); + otb::CassiniForwardProjection::Pointer lCassiniProjection2 = otb::CassiniForwardProjection::New(); + otb::CylEquAreaInverseProjection::Pointer lCylEquAreaProjection = otb::CylEquAreaInverseProjection::New(); + otb::CylEquAreaForwardProjection::Pointer lCylEquAreaProjection2 = otb::CylEquAreaForwardProjection::New(); + otb::Eckert4InverseProjection::Pointer lEckert4Projection = otb::Eckert4InverseProjection::New(); + otb::Eckert4ForwardProjection::Pointer lEckert4Projection2 = otb::Eckert4ForwardProjection::New(); + otb::Eckert6InverseProjection::Pointer lEckert6Projection = otb::Eckert6InverseProjection::New(); + otb::Eckert6ForwardProjection::Pointer lEckert6Projection2 = otb::Eckert6ForwardProjection::New(); + otb::GnomonicInverseProjection::Pointer lGnomonicProjection = otb::GnomonicInverseProjection::New(); + otb::GnomonicForwardProjection::Pointer lGnomonicProjection2 = otb::GnomonicForwardProjection::New(); + otb::LambertConformalConicInverseProjection::Pointer lLambertConformalConicProjection = + otb::LambertConformalConicInverseProjection::New(); + otb::LambertConformalConicForwardProjection::Pointer lLambertConformalConicProjection2 = + otb::LambertConformalConicForwardProjection::New(); + otb::LlxyInverseProjection::Pointer lLlxyProjection = otb::LlxyInverseProjection::New(); + otb::LlxyForwardProjection::Pointer lLlxyProjection2 = otb::LlxyForwardProjection::New(); + otb::EquDistCylInverseProjection::Pointer lEquDistCylProjection = otb::EquDistCylInverseProjection::New(); + otb::EquDistCylForwardProjection::Pointer lEquDistCylProjection2 = otb::EquDistCylForwardProjection::New(); + otb::MercatorInverseProjection::Pointer lMercatorProjection = otb::MercatorInverseProjection::New(); + otb::MercatorForwardProjection::Pointer lMercatorProjection2 = otb::MercatorForwardProjection::New(); + otb::MillerInverseProjection::Pointer lMillerProjection = otb::MillerInverseProjection::New(); + otb::MillerForwardProjection::Pointer lMillerProjection2 = otb::MillerForwardProjection::New(); + otb::MollweidInverseProjection::Pointer lMollweidProjection = otb::MollweidInverseProjection::New(); + otb::MollweidForwardProjection::Pointer lMollweidProjection2 = otb::MollweidForwardProjection::New(); + otb::NewZealandMapGridInverseProjection::Pointer lNewZealandMapGridProjection = + otb::NewZealandMapGridInverseProjection::New(); + otb::NewZealandMapGridForwardProjection::Pointer lNewZealandMapGridProjection2 = + otb::NewZealandMapGridForwardProjection::New(); + otb::ObliqueMercatorInverseProjection::Pointer lObliqueMercatorProjection = + otb::ObliqueMercatorInverseProjection::New(); + otb::ObliqueMercatorForwardProjection::Pointer lObliqueMercatorProjection2 = + otb::ObliqueMercatorForwardProjection::New(); + otb::OrthoGraphicInverseProjection::Pointer lOrthoGraphicProjection = + otb::OrthoGraphicInverseProjection::New(); + otb::OrthoGraphicForwardProjection::Pointer lOrthoGraphicProjection2 = + otb::OrthoGraphicForwardProjection::New(); + otb::PolarStereoInverseProjection::Pointer lPolarStereoProjection = otb::PolarStereoInverseProjection::New(); + otb::PolarStereoForwardProjection::Pointer lPolarStereoProjection2 = otb::PolarStereoForwardProjection::New(); + otb::PolyconicInverseProjection::Pointer lPolyconicProjection = otb::PolyconicInverseProjection::New(); + otb::PolyconicForwardProjection::Pointer lPolyconicProjection2 = otb::PolyconicForwardProjection::New(); + otb::SinusoidalInverseProjection::Pointer lSinusoidalProjection = otb::SinusoidalInverseProjection::New(); + otb::SinusoidalForwardProjection::Pointer lSinusoidalProjection2 = otb::SinusoidalForwardProjection::New(); + otb::SpaceObliqueMercatorInverseProjection::Pointer lSpaceObliqueMercatorProjection = + otb::SpaceObliqueMercatorInverseProjection::New(); + otb::SpaceObliqueMercatorForwardProjection::Pointer lSpaceObliqueMercatorProjection2 = + otb::SpaceObliqueMercatorForwardProjection::New(); + otb::StereographicInverseProjection::Pointer lStereographicProjection = + otb::StereographicInverseProjection::New(); + otb::StereographicForwardProjection::Pointer lStereographicProjection2 = + otb::StereographicForwardProjection::New(); + otb::TransCylEquAreaInverseProjection::Pointer lTransCylEquAreaProjection = + otb::TransCylEquAreaInverseProjection::New(); + otb::TransCylEquAreaForwardProjection::Pointer lTransCylEquAreaProjection2 = + otb::TransCylEquAreaForwardProjection::New(); + otb::TransMercatorInverseProjection::Pointer lTransMercatorProjection = + otb::TransMercatorInverseProjection::New(); + otb::TransMercatorForwardProjection::Pointer lTransMercatorProjection2 = + otb::TransMercatorForwardProjection::New(); + otb::UpsInverseProjection::Pointer lUpsProjection = otb::UpsInverseProjection::New(); + otb::UpsForwardProjection::Pointer lUpsProjection2 = otb::UpsForwardProjection::New(); + otb::UtmInverseProjection::Pointer lUtmProjection = otb::UtmInverseProjection::New(); + otb::UtmForwardProjection::Pointer lUtmProjection2 = otb::UtmForwardProjection::New(); + otb::VanDerGrintenInverseProjection::Pointer lVanDerGrintenProjection = + otb::VanDerGrintenInverseProjection::New(); + otb::VanDerGrintenForwardProjection::Pointer lVanDerGrintenProjection2 = + otb::VanDerGrintenForwardProjection::New(); otb::Lambert2EtenduInverseProjection::Pointer lLambert2Etendu = otb::Lambert2EtenduInverseProjection::New(); otb::Lambert2EtenduForwardProjection::Pointer lLambert2Etendu2 = otb::Lambert2EtenduForwardProjection::New(); - otb::Lambert93InverseProjection::Pointer lLambert93 = otb::Lambert93InverseProjection::New(); - otb::Lambert93ForwardProjection::Pointer lLambert93_2 = otb::Lambert93ForwardProjection::New(); - otb::SVY21InverseProjection::Pointer lSVY21 = otb::SVY21InverseProjection::New(); - otb::SVY21ForwardProjection::Pointer lSVY21_2 = otb::SVY21ForwardProjection::New(); + otb::Lambert93InverseProjection::Pointer lLambert93 = otb::Lambert93InverseProjection::New(); + otb::Lambert93ForwardProjection::Pointer lLambert93_2 = otb::Lambert93ForwardProjection::New(); + otb::SVY21InverseProjection::Pointer lSVY21 = otb::SVY21InverseProjection::New(); + otb::SVY21ForwardProjection::Pointer lSVY21_2 = otb::SVY21ForwardProjection::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbOrthoRectificationFilter.cxx b/Testing/Code/Projections/otbOrthoRectificationFilter.cxx index f8ad6c8cf5..43ec74454b 100644 --- a/Testing/Code/Projections/otbOrthoRectificationFilter.cxx +++ b/Testing/Code/Projections/otbOrthoRectificationFilter.cxx @@ -19,7 +19,6 @@ #pragma warning ( disable : 4786 ) #endif - // iostream is used for general output #include <iostream> #include <stdlib.h> @@ -35,58 +34,58 @@ #include "init/ossimInit.h" - -int otbOrthoRectificationFilter( int argc, char* argv[] ) +int otbOrthoRectificationFilter(int argc, char* argv[]) { ossimInit::instance()->initialize(argc, argv); - if (argc!=11) - { - std::cout << argv[0] <<" <input filename> <output filename> <origin easting> <origin northing> <x size> <y size> <x spacing> <y spacing> <UTM zone> <UTM hemisphere>" + if (argc != 11) + { + std::cout << argv[0] << + " <input filename> <output filename> <origin easting> <origin northing> <x size> <y size> <x spacing> <y spacing> <UTM zone> <UTM hemisphere>" << std::endl; return EXIT_FAILURE; - } + } - typedef otb::Image<double, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; - typedef otb::UtmInverseProjection UtmMapProjectionType; + typedef otb::Image<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::UtmInverseProjection UtmMapProjectionType; typedef otb::OrthoRectificationFilter<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType; //Allocate pointer - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); - UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); + OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); + UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); // Set parameters ... reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); reader->GenerateOutputInformation(); - std::cout<<reader->GetOutput()<<std::endl; + std::cout << reader->GetOutput() << std::endl; orthoRectifFilter->SetInput(reader->GetOutput()); ImageType::IndexType start; - start[0]=0; - start[1]=0; + start[0] = 0; + start[1] = 0; orthoRectifFilter->SetOutputStartIndex(start); ImageType::SizeType size; - size[0]=atoi(argv[5]); // X size - size[1]=atoi(argv[6]); //Y size + size[0] = atoi(argv[5]); // X size + size[1] = atoi(argv[6]); //Y size orthoRectifFilter->SetSize(size); ImageType::SpacingType spacing; - spacing[0]=atof(argv[7]); - spacing[1]=atof(argv[8]); + spacing[0] = atof(argv[7]); + spacing[1] = atof(argv[8]); orthoRectifFilter->SetOutputSpacing(spacing); ImageType::PointType origin; - origin[0]=strtod(argv[3], NULL); //Origin easting - origin[1]=strtod(argv[4], NULL); //Origin northing + origin[0] = strtod(argv[3], NULL); //Origin easting + origin[1] = strtod(argv[4], NULL); //Origin northing orthoRectifFilter->SetOutputOrigin(origin); utmMapProjection->SetZone(atoi(argv[9])); @@ -101,4 +100,3 @@ int otbOrthoRectificationFilter( int argc, char* argv[] ) return EXIT_SUCCESS; } - diff --git a/Testing/Code/Projections/otbOrthoRectificationFilterNew.cxx b/Testing/Code/Projections/otbOrthoRectificationFilterNew.cxx index 42c6b4019a..0c6f7274e3 100644 --- a/Testing/Code/Projections/otbOrthoRectificationFilterNew.cxx +++ b/Testing/Code/Projections/otbOrthoRectificationFilterNew.cxx @@ -21,16 +21,14 @@ #include "otbMapProjections.h" #include "otbOrthoRectificationFilter.h" - -int otbOrthoRectificationFilterNew( int argc, char* argv[] ) +int otbOrthoRectificationFilterNew(int argc, char* argv[]) { - typedef otb::Image<double, 2> ImageType; - typedef otb::UtmInverseProjection UtmMapProjectionType; + typedef otb::Image<double, 2> ImageType; + typedef otb::UtmInverseProjection UtmMapProjectionType; typedef otb::OrthoRectificationFilter<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType; - OrthoRectifFilterType::Pointer orthoRectifFilter=OrthoRectifFilterType::New(); + OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/Projections/otbOrthoRectificationFilterWithDEM.cxx b/Testing/Code/Projections/otbOrthoRectificationFilterWithDEM.cxx index 4f56e4f168..72197c73e3 100644 --- a/Testing/Code/Projections/otbOrthoRectificationFilterWithDEM.cxx +++ b/Testing/Code/Projections/otbOrthoRectificationFilterWithDEM.cxx @@ -19,7 +19,6 @@ #pragma warning ( disable : 4786 ) #endif - // iostream is used for general output #include <iostream> #include <iterator> @@ -46,33 +45,32 @@ #include "init/ossimInit.h" - -int otbOrthoRectificationFilterWithDEM( int argc, char* argv[] ) +int otbOrthoRectificationFilterWithDEM(int argc, char* argv[]) { ossimInit::instance()->initialize(argc, argv); - if (argc!=12) - { - std::cout << argv[0] <<" <input filename> <output filename> <origin easting> <origin northing> <x size> <y size>"; + if (argc != 12) + { + std::cout << argv[0] << + " <input filename> <output filename> <origin easting> <origin northing> <x size> <y size>"; std::cout << "<x_spacing> <y_spacing> <UTM zone> <UTM hemisphere> <DEM directory>" << std::endl; return EXIT_FAILURE; - } - + } - typedef otb::Image<double, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::Image<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; - typedef otb::UtmInverseProjection UtmMapProjectionType; + typedef otb::UtmInverseProjection UtmMapProjectionType; typedef otb::OrthoRectificationFilter<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType; //Allocate pointer - ReaderType::Pointer reader=ReaderType::New(); - WriterType::Pointer writer=WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - OrthoRectifFilterType::Pointer orthoRectifFilter=OrthoRectifFilterType::New(); - UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); + OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); + UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); // Set parameters ... reader->SetFileName(argv[1]); @@ -81,23 +79,23 @@ int otbOrthoRectificationFilterWithDEM( int argc, char* argv[] ) orthoRectifFilter->SetInput(reader->GetOutput()); ImageType::IndexType start; - start[0]=0; - start[1]=0; + start[0] = 0; + start[1] = 0; orthoRectifFilter->SetOutputStartIndex(start); ImageType::SizeType size; - size[0]=atoi(argv[5]); //X size. - size[1]=atoi(argv[6]); //Y size + size[0] = atoi(argv[5]); //X size. + size[1] = atoi(argv[6]); //Y size orthoRectifFilter->SetSize(size); ImageType::SpacingType spacing; - spacing[0]=atof(argv[7]); - spacing[1]=atof(argv[8]); + spacing[0] = atof(argv[7]); + spacing[1] = atof(argv[8]); orthoRectifFilter->SetOutputSpacing(spacing); ImageType::PointType origin; - origin[0]=strtod(argv[3], NULL); //origin easting - origin[1]=strtod(argv[4], NULL); //origin northing + origin[0] = strtod(argv[3], NULL); //origin easting + origin[1] = strtod(argv[4], NULL); //origin northing orthoRectifFilter->SetOutputOrigin(origin); utmMapProjection->SetZone(atoi(argv[9])); @@ -111,12 +109,9 @@ int otbOrthoRectificationFilterWithDEM( int argc, char* argv[] ) writer->SetTilingStreamDivisions(); - otbGenericMsgDebugMacro(<< "Update writer ..." ); + otbGenericMsgDebugMacro(<< "Update writer ..."); writer->Update(); - return EXIT_SUCCESS; } //End main() - - diff --git a/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx b/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx index 8c7543cdbf..29d98088bf 100644 --- a/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx +++ b/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx @@ -19,7 +19,6 @@ #pragma warning ( disable : 4786 ) #endif - // iostream is used for general output #include <iostream> #include <stdlib.h> @@ -36,58 +35,58 @@ #include "init/ossimInit.h" - -int otbOrthoRectificationMonoThreadFilter( int argc, char* argv[] ) +int otbOrthoRectificationMonoThreadFilter(int argc, char* argv[]) { ossimInit::instance()->initialize(argc, argv); - if (argc!=11) - { - std::cout << argv[0] <<" <input filename> <output filename> <origin easting> <origin northing> <x size> <y size> <x spacing> <y spacing> <UTM zone <UTM hemisphere>" + if (argc != 11) + { + std::cout << argv[0] << + " <input filename> <output filename> <origin easting> <origin northing> <x size> <y size> <x spacing> <y spacing> <UTM zone <UTM hemisphere>" << std::endl; return EXIT_FAILURE; - } + } - typedef otb::Image<double, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; - typedef otb::UtmInverseProjection UtmMapProjectionType; + typedef otb::Image<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::UtmInverseProjection UtmMapProjectionType; typedef otb::OrthoRectificationFilter<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType; //Allocate pointer - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); - UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); + OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); + UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); // Set parameters ... reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); reader->GenerateOutputInformation(); - std::cout<<reader->GetOutput()<<std::endl; + std::cout << reader->GetOutput() << std::endl; orthoRectifFilter->SetInput(reader->GetOutput()); ImageType::IndexType start; - start[0]=0; - start[1]=0; + start[0] = 0; + start[1] = 0; orthoRectifFilter->SetOutputStartIndex(start); ImageType::SizeType size; - size[0]=atoi(argv[5]); // X size - size[1]=atoi(argv[6]); //Y size + size[0] = atoi(argv[5]); // X size + size[1] = atoi(argv[6]); //Y size orthoRectifFilter->SetSize(size); ImageType::SpacingType spacing; - spacing[0]=atof(argv[7]); - spacing[1]=atof(argv[8]); + spacing[0] = atof(argv[7]); + spacing[1] = atof(argv[8]); orthoRectifFilter->SetOutputSpacing(spacing); ImageType::PointType origin; - origin[0]=strtod(argv[3], NULL); //Origin easting - origin[1]=strtod(argv[4], NULL); //Origin northing + origin[0] = strtod(argv[3], NULL); //Origin easting + origin[1] = strtod(argv[4], NULL); //Origin northing orthoRectifFilter->SetOutputOrigin(origin); utmMapProjection->SetZone(atoi(argv[9])); @@ -100,7 +99,5 @@ int otbOrthoRectificationMonoThreadFilter( int argc, char* argv[] ) writer->SetNumberOfThreads(1); writer->Update(); - return EXIT_SUCCESS; -}//Fin main() - +} //Fin main() diff --git a/Testing/Code/Projections/otbProjectionBaseNew.cxx b/Testing/Code/Projections/otbProjectionBaseNew.cxx index 4947cf6a59..9be9123fbc 100644 --- a/Testing/Code/Projections/otbProjectionBaseNew.cxx +++ b/Testing/Code/Projections/otbProjectionBaseNew.cxx @@ -26,15 +26,13 @@ #include "otbMapProjections.h" #include "otbMapToMapProjection.h" -int otbProjectionBaseNew( int argc, char* argv[] ) +int otbProjectionBaseNew(int argc, char* argv[]) { - otb::AlbersInverseProjection::Pointer lAlbersProjection = otb::AlbersInverseProjection::New(); + otb::AlbersInverseProjection::Pointer lAlbersProjection = otb::AlbersInverseProjection::New(); otb::AzimEquDistForwardProjection::Pointer lAzimEquDistProjection = otb::AzimEquDistForwardProjection::New(); - typedef otb::MapToMapProjection<otb::AlbersInverseProjection,otb::AzimEquDistForwardProjection> MapToMapProjectionType; + typedef otb::MapToMapProjection<otb::AlbersInverseProjection, + otb::AzimEquDistForwardProjection> MapToMapProjectionType; MapToMapProjectionType::Pointer lMapToMapProjection = MapToMapProjectionType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbProjectionsTests1.cxx b/Testing/Code/Projections/otbProjectionsTests1.cxx index c82c27aed3..c512126274 100644 --- a/Testing/Code/Projections/otbProjectionsTests1.cxx +++ b/Testing/Code/Projections/otbProjectionsTests1.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/Projections/otbProjectionsTests2.cxx b/Testing/Code/Projections/otbProjectionsTests2.cxx index ed84a9b77b..6d10594189 100644 --- a/Testing/Code/Projections/otbProjectionsTests2.cxx +++ b/Testing/Code/Projections/otbProjectionsTests2.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/Projections/otbProjectionsTests3.cxx b/Testing/Code/Projections/otbProjectionsTests3.cxx index ff8e6af55a..397914966f 100644 --- a/Testing/Code/Projections/otbProjectionsTests3.cxx +++ b/Testing/Code/Projections/otbProjectionsTests3.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() diff --git a/Testing/Code/Projections/otbRegionProjectionResampler.cxx b/Testing/Code/Projections/otbRegionProjectionResampler.cxx index 3c50eab81c..a7008e859f 100644 --- a/Testing/Code/Projections/otbRegionProjectionResampler.cxx +++ b/Testing/Code/Projections/otbRegionProjectionResampler.cxx @@ -53,43 +53,43 @@ #include "init/ossimInit.h" - -int otbRegionProjectionResampler( int argc, char* argv[] ) +int otbRegionProjectionResampler(int argc, char* argv[]) { ossimInit::instance()->initialize(argc, argv); - if (argc!=10) - { - std::cout << argv[0] <<" <input filename> <output filename> <latitude de l'origine> <longitude de l'origine> <taille_x> <taille_y> <NumberOfstreamDivisions>" << std::endl; + if (argc != 10) + { + std::cout << argv[0] << + " <input filename> <output filename> <latitude de l'origine> <longitude de l'origine> <taille_x> <taille_y> <NumberOfstreamDivisions>" + << std::endl; return EXIT_FAILURE; - } - + } typedef otb::Image<unsigned char, 2> CharImageType; typedef otb::Image<double, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingImageFileWriter<ImageType> WriterType; typedef otb::InverseSensorModel<double> ModelType; - typedef itk::LinearInterpolateImageFunction< ImageType, double > InterpolatorType; - typedef itk::RescaleIntensityImageFilter<ImageType,CharImageType> RescalerType; - typedef otb::StreamingResampleImageFilter< ImageType, ImageType > ResamplerType; - typedef itk::TranslationTransform<double,2> TransformType; - typedef otb::CompositeTransform<ModelType,TransformType> CompositeType; + typedef itk::LinearInterpolateImageFunction<ImageType, double> InterpolatorType; + typedef itk::RescaleIntensityImageFilter<ImageType, CharImageType> RescalerType; + typedef otb::StreamingResampleImageFilter<ImageType, ImageType> ResamplerType; + typedef itk::TranslationTransform<double, 2> TransformType; + typedef otb::CompositeTransform<ModelType, TransformType> CompositeType; - ImageType::IndexType start; + ImageType::IndexType start; ImageType::SizeType size; - ImageType::SpacingType spacing; - ImageType::PointType origin; - ImageType::RegionType region; + ImageType::SpacingType spacing; + ImageType::PointType origin; + ImageType::RegionType region; //Allocate pointer - ModelType::Pointer model = ModelType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - InterpolatorType::Pointer interpolator = InterpolatorType::New(); - RescalerType::Pointer rescaler = RescalerType::New(); - ResamplerType::Pointer resampler = ResamplerType::New(); + ModelType::Pointer model = ModelType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + InterpolatorType::Pointer interpolator = InterpolatorType::New(); + RescalerType::Pointer rescaler = RescalerType::New(); + ResamplerType::Pointer resampler = ResamplerType::New(); // Set parameters ... reader->SetFileName(argv[1]); @@ -103,41 +103,39 @@ int otbRegionProjectionResampler( int argc, char* argv[] ) model->SetImageGeometry(reader->GetOutput()->GetImageKeywordlist()); - start[0]=0; - start[1]=0; - size[0]=atoi(argv[5]); // X size. - size[1]=atoi(argv[6]); // Y size. + start[0] = 0; + start[1] = 0; + size[0] = atoi(argv[5]); // X size. + size[1] = atoi(argv[6]); // Y size. region.SetSize(size); region.SetIndex(start); - spacing[0]=atof(argv[8]); - spacing[1]=atof(argv[9]); + spacing[0] = atof(argv[8]); + spacing[1] = atof(argv[9]); - origin[0]=strtod(argv[3], NULL); // origin longitude. - origin[1]=strtod(argv[4], NULL); // origin latitude. + origin[0] = strtod(argv[3], NULL); // origin longitude. + origin[1] = strtod(argv[4], NULL); // origin latitude. - otbGenericMsgDebugMacro(<< "Origin " << origin ); + otbGenericMsgDebugMacro(<< "Origin " << origin); - resampler->SetOutputSpacing( spacing ); - resampler->SetOutputOrigin( origin ); - resampler->SetSize( region.GetSize() ); - resampler->SetOutputStartIndex( start ); + resampler->SetOutputSpacing(spacing); + resampler->SetOutputOrigin(origin); + resampler->SetSize(region.GetSize()); + resampler->SetOutputStartIndex(start); //Connect pipeline - resampler->SetInput( reader->GetOutput() ); - resampler->SetTransform( model ); - resampler->SetInterpolator( interpolator ); + resampler->SetInput(reader->GetOutput()); + resampler->SetTransform(model); + resampler->SetInterpolator(interpolator); otbGenericMsgDebugMacro(<< "Sensor Model :" << model); writer->SetInput(resampler->GetOutput()); writer->SetTilingStreamDivisions(10); - otbGenericMsgDebugMacro(<< "Update writer ..." ); + otbGenericMsgDebugMacro(<< "Update writer ..."); writer->Update(); - return EXIT_SUCCESS; -}//Fin main() - +} //Fin main() diff --git a/Testing/Code/Projections/otbSensorModel.cxx b/Testing/Code/Projections/otbSensorModel.cxx index bf362af6c7..0635874a65 100644 --- a/Testing/Code/Projections/otbSensorModel.cxx +++ b/Testing/Code/Projections/otbSensorModel.cxx @@ -30,11 +30,11 @@ int otbSensorModel(int argc, char* argv[]) { if (argc != 3) - { + { std::cout << argv[0] << " <input filename> <output filename>" << std::endl; return EXIT_FAILURE; - } + } char * filename = argv[1]; char * outFilename = argv[2]; @@ -55,25 +55,25 @@ int otbSensorModel(int argc, char* argv[]) //** Truncate precision of meters_per_pixel */ ossimKeywordlist geom_kwl; - ossimString s; - double value; + ossimString s; + double value; reader->GetOutput()->GetImageKeywordlist().convertToOSSIMKeywordlist(geom_kwl); file << std::setprecision(5); s = geom_kwl.find("meters_per_pixel_x"); if (s != "") - { + { value = s.toDouble(); file << "truncate_meter_per_pixel_x " << value << std::endl; - } + } s = geom_kwl.find("meters_per_pixel_y"); if (s != "") - { + { value = s.toDouble(); file << "truncate_meter_per_pixel_y " << value << std::endl; - } + } file << std::setprecision(15); diff --git a/Testing/Code/Projections/otbSensorModelsNew.cxx b/Testing/Code/Projections/otbSensorModelsNew.cxx index 14fa94a4e8..8d67e09b97 100644 --- a/Testing/Code/Projections/otbSensorModelsNew.cxx +++ b/Testing/Code/Projections/otbSensorModelsNew.cxx @@ -27,7 +27,7 @@ #include "otbForwardSensorModel.h" #include "otbInverseSensorModel.h" -int otbSensorModelsNew( int argc, char* argv[] ) +int otbSensorModelsNew(int argc, char* argv[]) { typedef otb::SensorModelBase<double> SensorModelBaseType; SensorModelBaseType::Pointer lSensorModelBase = SensorModelBaseType::New(); @@ -38,8 +38,5 @@ int otbSensorModelsNew( int argc, char* argv[] ) typedef otb::ForwardSensorModel<double> ForwardSensorModelType; ForwardSensorModelType::Pointer lForwardSensorModel = ForwardSensorModelType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbTileMapTransform.cxx b/Testing/Code/Projections/otbTileMapTransform.cxx index e912d1ef71..ce37c5b3bc 100644 --- a/Testing/Code/Projections/otbTileMapTransform.cxx +++ b/Testing/Code/Projections/otbTileMapTransform.cxx @@ -21,7 +21,7 @@ int otbTileMapTransform(int argc, char* argv[]) { - const char * outFileName = argv[1]; + const char * outFileName = argv[1]; std::ofstream file; file.open(outFileName); @@ -31,16 +31,16 @@ int otbTileMapTransform(int argc, char* argv[]) file << std::setprecision(15); file << "Forward projection: level " << projection->GetLevel() << std::endl; - itk::Point<double,2> point; - point[0] = 0;//lon - point[1] = 0;//lat + itk::Point<double, 2> point; + point[0] = 0; //lon + point[1] = 0; //lat file << point << " -> "; file << projection->TransformPoint(point); file << std::endl << std::endl; - point[0] = 1.48;//lon - point[1] = 43.55;//lat + point[0] = 1.48; //lon + point[1] = 43.55; //lat file << point << " -> "; file << projection->TransformPoint(point); @@ -52,8 +52,8 @@ int otbTileMapTransform(int argc, char* argv[]) file << "Inverse projection: level " << inverseProjection->GetLevel() << std::endl; - point[0] = 132149;//X - point[1] = 95774;//Y + point[0] = 132149; //X + point[1] = 95774; //Y file << point << " -> "; file << inverseProjection->TransformPoint(point); diff --git a/Testing/Code/Projections/otbVectorDataExtractROIandProjection.cxx b/Testing/Code/Projections/otbVectorDataExtractROIandProjection.cxx index d981e3cb41..9b4fb1fcf9 100644 --- a/Testing/Code/Projections/otbVectorDataExtractROIandProjection.cxx +++ b/Testing/Code/Projections/otbVectorDataExtractROIandProjection.cxx @@ -24,12 +24,11 @@ #include <fstream> #include <iostream> - int otbVectorDataExtractROIandProjection(int argc, char * argv[]) { //Read the vector data - typedef otb::VectorData<> VectorDataType; + typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); @@ -40,31 +39,31 @@ int otbVectorDataExtractROIandProjection(int argc, char * argv[]) ProjectionFilterType::Pointer projection = ProjectionFilterType::New(); projection->SetInput(reader->GetOutput()); // projection->Update(); - std::string projectionRefWkt ="PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; + std::string projectionRefWkt = + "PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; projection->SetOutputProjectionRef(projectionRefWkt); - //Convert the vector data into an image - typedef otb::Image<unsigned int,2> ImageType; + typedef otb::Image<unsigned int, 2> ImageType; ImageType::SizeType size; size[0] = 500; size[1] = 500; ImageType::PointType origin; - origin[0] = 374149.980555821;//UL easting - origin[1] = 4829183.99443839;//UL northing + origin[0] = 374149.980555821; //UL easting + origin[1] = 4829183.99443839; //UL northing ImageType::SpacingType spacing; spacing[0] = 0.6; spacing[1] = -0.6; typedef otb::RemoteSensingRegion<double> RegionType; - RegionType region; + RegionType region; RegionType::SizeType sizeInUnit; - sizeInUnit[0] = size[0]*spacing[0]; - sizeInUnit[1] = size[1]*spacing[1]; + sizeInUnit[0] = size[0] * spacing[0]; + sizeInUnit[1] = size[1] * spacing[1]; region.SetSize(sizeInUnit); region.SetOrigin(origin); region.SetRegionProjection(projectionRefWkt); @@ -75,21 +74,19 @@ int otbVectorDataExtractROIandProjection(int argc, char * argv[]) extractROI->SetInput(projection->GetOutput()); extractROI->Update(); - unsigned int elementsKeptAfterProj = extractROI->GetOutput()->Size(); std::cout << "After projection: kept " << elementsKeptAfterProj << " features." << std::endl; - + extractROI->SetInput(reader->GetOutput()); extractROI->Update(); unsigned int elementsKeptAfterReader = extractROI->GetOutput()->Size(); std::cout << "Directly from reader: kept " << elementsKeptAfterReader << " features." << std::endl; - if (elementsKeptAfterProj != elementsKeptAfterReader) - { + { return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/Projections/otbVectorDataProjectionFilter.cxx b/Testing/Code/Projections/otbVectorDataProjectionFilter.cxx index 13fa64bf06..6c0c86a95e 100644 --- a/Testing/Code/Projections/otbVectorDataProjectionFilter.cxx +++ b/Testing/Code/Projections/otbVectorDataProjectionFilter.cxx @@ -22,20 +22,18 @@ #include "otbVectorDataFileWriter.h" #include "otbStandardFilterWatcher.h" - int otbVectorDataProjectionFilter(int argc, char * argv[]) { - if (argc < 3 ) - { - std::cout << argv[0] <<" <input filename> <output filename> [<output text>]" << std::endl; + if (argc < 3) + { + std::cout << argv[0] << " <input filename> <output filename> [<output text>]" << std::endl; return EXIT_FAILURE; - } - - typedef otb::VectorData<double > InputVectorDataType; - typedef otb::VectorData<double > OutputVectorDataType; + } + typedef otb::VectorData<double> InputVectorDataType; + typedef otb::VectorData<double> OutputVectorDataType; typedef otb::VectorDataFileReader<InputVectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); @@ -43,14 +41,14 @@ int otbVectorDataProjectionFilter(int argc, char * argv[]) reader->SetFileName(argv[1]); reader->UpdateOutputInformation(); - typedef otb::VectorDataProjectionFilter<InputVectorDataType,OutputVectorDataType> VectorDataFilterType; + typedef otb::VectorDataProjectionFilter<InputVectorDataType, OutputVectorDataType> VectorDataFilterType; VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); vectorDataProjection->SetInput(reader->GetOutput()); - - std::string projectionRefWkt ="PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; + std::string projectionRefWkt = + "PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; vectorDataProjection->SetOutputProjectionRef(projectionRefWkt); @@ -62,11 +60,10 @@ int otbVectorDataProjectionFilter(int argc, char * argv[]) writer->SetInput(vectorDataProjection->GetOutput()); writer->Update(); - //Output the tree in a text file if (argc >= 4) - { - const char * outfile = argv[3]; + { + const char * outfile = argv[3]; std::ofstream file; file.open(outfile); @@ -82,9 +79,7 @@ int otbVectorDataProjectionFilter(int argc, char * argv[]) file << data2; file << std::endl << std::endl; file.close(); - } + } return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToGeo.cxx b/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToGeo.cxx index e2e68d94b5..d2a2cb1dab 100644 --- a/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToGeo.cxx +++ b/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToGeo.cxx @@ -24,16 +24,15 @@ int otbVectorDataProjectionFilterFromMapToGeo(int argc, char * argv[]) { - if (argc < 2 ) - { - std::cout << argv[0] <<" <input vector filename> <output vector filename> " << std::endl; + if (argc < 2) + { + std::cout << argv[0] << " <input vector filename> <output vector filename> " << std::endl; return EXIT_FAILURE; - } - - typedef otb::VectorData<double > InputVectorDataType; - typedef otb::VectorData<double > OutputVectorDataType; + } + typedef otb::VectorData<double> InputVectorDataType; + typedef otb::VectorData<double> OutputVectorDataType; typedef otb::VectorDataFileReader<InputVectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); @@ -41,8 +40,7 @@ int otbVectorDataProjectionFilterFromMapToGeo(int argc, char * argv[]) reader->SetFileName(argv[1]); reader->UpdateOutputInformation(); - - typedef otb::VectorDataProjectionFilter<InputVectorDataType,OutputVectorDataType> VectorDataFilterType; + typedef otb::VectorDataProjectionFilter<InputVectorDataType, OutputVectorDataType> VectorDataFilterType; VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); vectorDataProjection->SetInput(reader->GetOutput()); @@ -54,8 +52,5 @@ int otbVectorDataProjectionFilterFromMapToGeo(int argc, char * argv[]) writer->SetInput(vectorDataProjection->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToImage.cxx b/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToImage.cxx index df59f989f2..ee2a6614b7 100644 --- a/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToImage.cxx +++ b/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToImage.cxx @@ -27,17 +27,16 @@ int otbVectorDataProjectionFilterFromMapToImage(int argc, char * argv[]) { - if (argc < 4 ) - { - std::cout << argv[0] <<" <input vector filename> <input image filename>" + if (argc < 4) + { + std::cout << argv[0] << " <input vector filename> <input image filename>" << " <output vector filename> " << std::endl; return EXIT_FAILURE; - } - - typedef otb::VectorData<double > InputVectorDataType; - typedef otb::VectorData<double > OutputVectorDataType; + } + typedef otb::VectorData<double> InputVectorDataType; + typedef otb::VectorData<double> OutputVectorDataType; typedef otb::VectorDataFileReader<InputVectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); @@ -45,15 +44,13 @@ int otbVectorDataProjectionFilterFromMapToImage(int argc, char * argv[]) reader->SetFileName(argv[1]); reader->UpdateOutputInformation(); - typedef otb::Image<unsigned short int, 2> ImageType; typedef otb::ImageFileReader<ImageType> ImageReaderType; ImageReaderType::Pointer imageReader = ImageReaderType::New(); imageReader->SetFileName(argv[2]); imageReader->UpdateOutputInformation(); - - typedef otb::VectorDataProjectionFilter<InputVectorDataType,OutputVectorDataType> VectorDataFilterType; + typedef otb::VectorDataProjectionFilter<InputVectorDataType, OutputVectorDataType> VectorDataFilterType; VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); @@ -63,13 +60,11 @@ int otbVectorDataProjectionFilterFromMapToImage(int argc, char * argv[]) vectorDataProjection->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); vectorDataProjection->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); - typedef otb::VectorDataFileWriter<OutputVectorDataType> VectorDataFileWriterType; VectorDataFileWriterType::Pointer writer = VectorDataFileWriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(vectorDataProjection->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToSensor.cxx b/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToSensor.cxx index 446f15376a..633e807e28 100644 --- a/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToSensor.cxx +++ b/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToSensor.cxx @@ -27,17 +27,16 @@ int otbVectorDataProjectionFilterFromMapToSensor(int argc, char * argv[]) { - if (argc < 4 ) - { - std::cout << argv[0] <<" <input vector filename> <input image filename>" + if (argc < 4) + { + std::cout << argv[0] << " <input vector filename> <input image filename>" << " <output vector filename> " << std::endl; return EXIT_FAILURE; - } - - typedef otb::VectorData<double > InputVectorDataType; - typedef otb::VectorData<double > OutputVectorDataType; + } + typedef otb::VectorData<double> InputVectorDataType; + typedef otb::VectorData<double> OutputVectorDataType; typedef otb::VectorDataFileReader<InputVectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); @@ -45,15 +44,13 @@ int otbVectorDataProjectionFilterFromMapToSensor(int argc, char * argv[]) reader->SetFileName(argv[1]); reader->UpdateOutputInformation(); - typedef otb::Image<unsigned short int, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ImageReaderType; + typedef otb::ImageFileReader<ImageType> ImageReaderType; ImageReaderType::Pointer imageReader = ImageReaderType::New(); imageReader->SetFileName(argv[2]); imageReader->UpdateOutputInformation(); - - typedef otb::VectorDataProjectionFilter<InputVectorDataType,OutputVectorDataType> VectorDataFilterType; + typedef otb::VectorDataProjectionFilter<InputVectorDataType, OutputVectorDataType> VectorDataFilterType; VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); @@ -63,15 +60,11 @@ int otbVectorDataProjectionFilterFromMapToSensor(int argc, char * argv[]) vectorDataProjection->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); vectorDataProjection->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); - typedef otb::VectorDataFileWriter<OutputVectorDataType> VectorDataFileWriterType; VectorDataFileWriterType::Pointer writer = VectorDataFileWriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(vectorDataProjection->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Projections/otbVectorDataProjectionFilterNew.cxx b/Testing/Code/Projections/otbVectorDataProjectionFilterNew.cxx index 3f0813c70b..cce64c14c0 100644 --- a/Testing/Code/Projections/otbVectorDataProjectionFilterNew.cxx +++ b/Testing/Code/Projections/otbVectorDataProjectionFilterNew.cxx @@ -22,16 +22,12 @@ int otbVectorDataProjectionFilterNew(int argc, char * argv[]) { + typedef otb::VectorData<double> InputVectorDataType; + typedef otb::VectorData<double> OutputVectorDataType; - typedef otb::VectorData<double > InputVectorDataType; - typedef otb::VectorData<double > OutputVectorDataType; - - typedef otb::VectorDataProjectionFilter<InputVectorDataType,OutputVectorDataType> VectorDataFilterType; + typedef otb::VectorDataProjectionFilter<InputVectorDataType, OutputVectorDataType> VectorDataFilterType; VectorDataFilterType::Pointer vectorData = VectorDataFilterType::New(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Radiometry/otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx index ad87df0b9f..76637c8a95 100644 --- a/Testing/Code/Radiometry/otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx @@ -24,25 +24,24 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - int otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::AVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType > FunctorType; - typedef otb::MultiChannelRAndGAndNIRIndexImageFilter<InputImageType,OutputImageType,FunctorType> - MultiChannelRAndGAndNIRIndexImageFilterType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Functor::AVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> FunctorType; + typedef otb::MultiChannelRAndGAndNIRIndexImageFilter<InputImageType, OutputImageType, FunctorType> + MultiChannelRAndGAndNIRIndexImageFilterType; // Instantiating object MultiChannelRAndGAndNIRIndexImageFilterType::Pointer filter = MultiChannelRAndGAndNIRIndexImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -51,25 +50,23 @@ int otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter(int argc, char * arg unsigned int greenChannel(::atoi(argv[4])); unsigned int nirChannel(::atoi(argv[5])); - double lg(::atof(argv[6])); - double lr(::atof(argv[7])); - double lnir(::atof(argv[8])); + double lg(::atof(argv[6])); + double lr(::atof(argv[7])); + double lnir(::atof(argv[8])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetRedIndex(redChannel); filter->SetGreenIndex(greenChannel); filter->SetNIRIndex(nirChannel); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); filter->GetFunctor().SetLambdaG(lg); filter->GetFunctor().SetLambdaR(lr); filter->GetFunctor().SetLambdaNir(lnir); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Radiometry/otbAVIRAndGAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbAVIRAndGAndNIRVegetationIndexImageFilter.cxx index 4b00ba66d1..627b65c601 100644 --- a/Testing/Code/Radiometry/otbAVIRAndGAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbAVIRAndGAndNIRVegetationIndexImageFilter.cxx @@ -23,66 +23,61 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - int otbAVIRAndGAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputGImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; - - typedef otb::ImageFileReader<InputRImageType> RReaderType; - typedef otb::ImageFileReader<InputGImageType> GReaderType; - typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - typedef otb::Functor::AVI< InputRImageType::PixelType, - InputGImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType > FunctorType; - - typedef otb::RAndGAndNIRIndexImageFilter< InputRImageType, - InputGImageType, - InputNIRImageType, - OutputImageType, - FunctorType > RAndGAndNIRIndexImageFilterType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputGImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; + + typedef otb::ImageFileReader<InputRImageType> RReaderType; + typedef otb::ImageFileReader<InputGImageType> GReaderType; + typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + + typedef otb::Functor::AVI<InputRImageType::PixelType, + InputGImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> FunctorType; + + typedef otb::RAndGAndNIRIndexImageFilter<InputRImageType, + InputGImageType, + InputNIRImageType, + OutputImageType, + FunctorType> RAndGAndNIRIndexImageFilterType; // Instantiating object RAndGAndNIRIndexImageFilterType::Pointer filter = RAndGAndNIRIndexImageFilterType::New(); - RReaderType::Pointer readerR = RReaderType::New(); - GReaderType::Pointer readerG = GReaderType::New(); - NIRReaderType::Pointer readerNIR = NIRReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - + RReaderType::Pointer readerR = RReaderType::New(); + GReaderType::Pointer readerG = GReaderType::New(); + NIRReaderType::Pointer readerNIR = NIRReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilenameR = argv[1]; const char * inputFilenameG = argv[2]; const char * inputFilenameNIR = argv[3]; const char * outputFilename = argv[4]; - double lg(::atof(argv[5])); - double lr(::atof(argv[6])); - double lnir(::atof(argv[7])); - + double lg(::atof(argv[5])); + double lr(::atof(argv[6])); + double lnir(::atof(argv[7])); - readerR->SetFileName( inputFilenameR ); - readerG->SetFileName( inputFilenameG ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputG( readerG->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); + readerR->SetFileName(inputFilenameR); + readerG->SetFileName(inputFilenameG); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputG(readerG->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); filter->GetFunctor().SetLambdaR(lr); filter->GetFunctor().SetLambdaG(lg); filter->GetFunctor().SetLambdaNir(lnir); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Radiometry/otbAeronetExtractData.cxx b/Testing/Code/Radiometry/otbAeronetExtractData.cxx index 170c2651c4..5c65c2ba52 100644 --- a/Testing/Code/Radiometry/otbAeronetExtractData.cxx +++ b/Testing/Code/Radiometry/otbAeronetExtractData.cxx @@ -25,7 +25,7 @@ int otbAeronetExtractData(int argc, char * argv[]) { otb::AeronetFileReader::Pointer reader = otb::AeronetFileReader::New(); - + reader->SetFileName(argv[1]); reader->SetDay(atoi(argv[2])); reader->SetMonth(atoi(argv[3])); @@ -39,26 +39,26 @@ int otbAeronetExtractData(int argc, char * argv[]) std::ofstream fout(argv[8]); - fout << "Aeronet data extracted:"<<std::endl; - fout << "Input file name: "<<otb::System::GetShortFileName(std::string(argv[1]))<<std::endl; - fout << "Inputs user parameters:"<<std::endl; - fout << " Day: "<<reader->GetDay()<<std::endl; - fout << " Month: "<<reader->GetMonth()<<std::endl; - fout << " Year: "<<reader->GetYear()<<std::endl; - fout << " Hour: "<<reader->GetHour()<<std::endl; - fout << " Minute: "<<reader->GetMinute()<<std::endl; - fout << "Outputs results:"<<std::endl; - fout << std::setprecision(15)<<std::endl; - fout << " AerosolOpticalThickness: "<<data->GetAerosolOpticalThickness()<<std::endl; - fout << " AngstromCoefficient: "<<data->GetAngstromCoefficient()<<std::endl; - fout << " Water: "<<data->GetWater()<<std::endl; - fout << " CloudEstimation: "<<data->GetCloudEstimation()<<std::endl; - fout << " SolarZenithAngle: "<<data->GetSolarZenithAngle()<<std::endl; - fout << " Statisctics:"<<std::endl; - fout << " Date: "<<data->GetDataDate()<<std::endl; - fout << " Epsilon date: "<<data->GetEpsilonDate()<<std::endl; - fout << " Number Of date used: "<<data->GetNumberOfDateUsed()<<std::endl; - fout << " StdDev Aero. Optical Thic.:"<<data->GetStdDev()<<std::endl; + fout << "Aeronet data extracted:" << std::endl; + fout << "Input file name: " << otb::System::GetShortFileName(std::string(argv[1])) << std::endl; + fout << "Inputs user parameters:" << std::endl; + fout << " Day: " << reader->GetDay() << std::endl; + fout << " Month: " << reader->GetMonth() << std::endl; + fout << " Year: " << reader->GetYear() << std::endl; + fout << " Hour: " << reader->GetHour() << std::endl; + fout << " Minute: " << reader->GetMinute() << std::endl; + fout << "Outputs results:" << std::endl; + fout << std::setprecision(15) << std::endl; + fout << " AerosolOpticalThickness: " << data->GetAerosolOpticalThickness() << std::endl; + fout << " AngstromCoefficient: " << data->GetAngstromCoefficient() << std::endl; + fout << " Water: " << data->GetWater() << std::endl; + fout << " CloudEstimation: " << data->GetCloudEstimation() << std::endl; + fout << " SolarZenithAngle: " << data->GetSolarZenithAngle() << std::endl; + fout << " Statisctics:" << std::endl; + fout << " Date: " << data->GetDataDate() << std::endl; + fout << " Epsilon date: " << data->GetEpsilonDate() << std::endl; + fout << " Number Of date used: " << data->GetNumberOfDateUsed() << std::endl; + fout << " StdDev Aero. Optical Thic.:" << data->GetStdDev() << std::endl; fout.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/Radiometry/otbAeronetExtractDataBadData.cxx b/Testing/Code/Radiometry/otbAeronetExtractDataBadData.cxx index d832ba9fd8..6974313ea6 100644 --- a/Testing/Code/Radiometry/otbAeronetExtractDataBadData.cxx +++ b/Testing/Code/Radiometry/otbAeronetExtractDataBadData.cxx @@ -32,12 +32,12 @@ int otbAeronetExtractDataBadData(int argc, char * argv[]) reader->SetEpsilon(atof(argv[7])); try - { + { reader->Update(); - } - catch ( itk::ExceptionObject e ) - { - return EXIT_SUCCESS; - } + } + catch (itk::ExceptionObject e) + { + return EXIT_SUCCESS; + } return EXIT_FAILURE; } diff --git a/Testing/Code/Radiometry/otbAeronetNew.cxx b/Testing/Code/Radiometry/otbAeronetNew.cxx index a53cd8bea5..dca4dfb4e4 100644 --- a/Testing/Code/Radiometry/otbAeronetNew.cxx +++ b/Testing/Code/Radiometry/otbAeronetNew.cxx @@ -20,7 +20,7 @@ int otbAeronetNew(int argc, char * argv[]) { - otb::AeronetData::Pointer data = otb::AeronetData::New(); + otb::AeronetData::Pointer data = otb::AeronetData::New(); otb::AeronetFileReader::Pointer reader = otb::AeronetFileReader::New(); return EXIT_SUCCESS; diff --git a/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersNew.cxx b/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersNew.cxx index 2c7cb00a33..fa2b03b3f9 100644 --- a/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersNew.cxx +++ b/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersNew.cxx @@ -26,11 +26,11 @@ int otbAtmosphericCorrectionParametersNew(int argc, char * argv[]) { - typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; - typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; + typedef otb::FilterFunctionValues FilterFunctionValuesType; // Instantiating object AtmosphericCorrectionParametersType::Pointer objectAtmo = AtmosphericCorrectionParametersType::New(); - FilterFunctionValuesType::Pointer objectFilter = FilterFunctionValuesType::New(); + FilterFunctionValuesType::Pointer objectFilter = FilterFunctionValuesType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx b/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx index 413797dfb8..95fb500941 100644 --- a/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx +++ b/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx @@ -30,13 +30,13 @@ int otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms(int argc, ch const char * wavelenghFile = argv[1]; const char * outputFile = argv[2]; - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms CorrectionParametersTo6SRadiativeTermsType; - typedef otb::AtmosphericCorrectionParameters CorrectionParametersType; - typedef otb::AtmosphericRadiativeTerms RadiativeTermsType; - typedef CorrectionParametersType::AerosolModelType AerosolModelType; - typedef otb::FilterFunctionValues FilterFunctionValuesType; - typedef FilterFunctionValuesType::WavelenghtSpectralBandType ValueType; - typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; + typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms CorrectionParametersTo6SRadiativeTermsType; + typedef otb::AtmosphericCorrectionParameters CorrectionParametersType; + typedef otb::AtmosphericRadiativeTerms RadiativeTermsType; + typedef CorrectionParametersType::AerosolModelType AerosolModelType; + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::WavelenghtSpectralBandType ValueType; + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; // Instantiating object CorrectionParametersTo6SRadiativeTermsType::Pointer object = CorrectionParametersTo6SRadiativeTermsType::New(); @@ -58,50 +58,49 @@ int otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms(int argc, ch float maxSpectralValue(0.); float value(0.); // Correction parameters initialization - double solarZenithalAngle(0.); - double solarAzimutalAngle(0.); - double viewingZenithalAngle(0.); - double viewingAzimutalAngle(0.); + double solarZenithalAngle(0.); + double solarAzimutalAngle(0.); + double viewingZenithalAngle(0.); + double viewingAzimutalAngle(0.); unsigned int month(0); unsigned int day(0); - double atmosphericPressure(0.); - double waterVaporAmount(0.); - double ozoneAmount(0.); - double aerosolOptical(0.); - + double atmosphericPressure(0.); + double waterVaporAmount(0.); + double ozoneAmount(0.); + double aerosolOptical(0.); std::ifstream fin; std::ofstream fout; //Read input file parameters fin.open(wavelenghFile); - fin >> solarZenithalAngle;//asol; - fin >> solarAzimutalAngle;//phi0; - fin >> viewingZenithalAngle;//avis; - fin >> viewingAzimutalAngle;//phiv; - fin >> month;//month; - fin >> day;//jday; - fin >> atmosphericPressure;//pressure; - fin >> waterVaporAmount;//uw; - fin >> ozoneAmount;//uo3; + fin >> solarZenithalAngle; //asol; + fin >> solarAzimutalAngle; //phi0; + fin >> viewingZenithalAngle; //avis; + fin >> viewingAzimutalAngle; //phiv; + fin >> month; //month; + fin >> day; //jday; + fin >> atmosphericPressure; //pressure; + fin >> waterVaporAmount; //uw; + fin >> ozoneAmount; //uo3; unsigned int aer(0); - fin >> aer;//iaer; + fin >> aer; //iaer; aerosolModel = static_cast<AerosolModelType>(aer); - fin >> aerosolOptical;//taer55; - fin >> minSpectralValue;//wlinf; - fin >> maxSpectralValue;//wlsup; + fin >> aerosolOptical; //taer55; + fin >> minSpectralValue; //wlinf; + fin >> maxSpectralValue; //wlsup; //fin.open(wavelenghFiles[i]); while (fin.good()) - { + { fin >> value; vect.push_back(value); - } + } fin.close(); functionValues->SetFilterFunctionValues(vect); functionValues->SetMinSpectralValue(minSpectralValue); functionValues->SetMaxSpectralValue(maxSpectralValue); - functionValues->SetUserStep( val ); + functionValues->SetUserStep(val); param->SetWavelenghtSpectralBandWithIndex(0, functionValues); //} @@ -120,53 +119,65 @@ int otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms(int argc, ch param->SetAerosolModel(aerosolModel); param->SetAerosolOptical(static_cast<double>(aerosolOptical)); - object->SetInput( param ); + object->SetInput(param); object->Update(); radiative = object->GetOutput(); fout.open(outputFile); - fout <<" ---------------------------------------------------------"<<std::endl; - fout << "Inputs values:"<<std::setprecision(10)<<std::endl; - fout << " -----> SolarZenithalAngle : "<<solarZenithalAngle<<std::endl; - fout << " -----> SolarAzimutalAngle : "<<solarAzimutalAngle<<std::endl; - fout << " -----> ViewingZenithalAngle : "<<viewingZenithalAngle<<std::endl; - fout << " -----> ViewingAzimutalAngle : "<<viewingAzimutalAngle<<std::endl; - fout << " -----> Month : "<<month<<std::endl; - fout << " -----> Day : "<<day<<std::endl; - fout << " -----> AtmosphericPressure : "<<atmosphericPressure<<std::endl; - fout << " -----> WaterVaporAmount : "<<waterVaporAmount<<std::endl; - fout << " -----> OzoneAmount : "<<ozoneAmount<<std::endl; - fout << " -----> AerosolModel : "<<aer<<std::endl; - fout << " -----> AerosolOptical : "<<aerosolOptical<<std::endl; - fout << " -----> MinSpectralValue : "<<minSpectralValue<<std::endl; - fout << " -----> MaxSpectralValue : "<<maxSpectralValue<<std::endl; - fout << " -----> UserStep : "<<functionValues->GetUserStep()<<std::endl; - fout <<" ---------------------------------------------------------"<<std::endl; - fout << "Outputs values:"<<std::endl; - fout << " -----> atmospheric reflectance : "<<radiative->GetIntrinsicAtmosphericReflectance(0)<<std::endl; - fout << " -----> atmospheric spherical albedo : "<<radiative->GetSphericalAlbedo(0)<<std::endl; - fout << " -----> total gaseous transmission : "<<radiative->GetTotalGaseousTransmission(0)<<std::endl; - fout << " -----> downward transmittance : "<<radiative->GetDownwardTransmittance(0)<<std::endl; - fout << " -----> upward transmittance : "<<radiative->GetUpwardTransmittance(0)<<std::endl; - fout << " -----> upward diffuse transmittance : "<<radiative->GetUpwardDiffuseTransmittance(0)<<std::endl; - fout << " -----> upward direct transmittance : "<<radiative->GetUpwardDirectTransmittance(0)<<std::endl; - fout << " -----> upward diffuse transmittance for rayleigh : "<<radiative->GetUpwardDiffuseTransmittanceForRayleigh(0)<<std::endl; - fout << " -----> upward diffuse transmittance for aerosols : "<<radiative->GetUpwardDiffuseTransmittanceForAerosol(0)<<std::endl; - fout << " -----> MinSpectralValue update: "<<functionValues->GetMinSpectralValue()<<std::endl; - fout << " -----> MaxSpectralValue update : "<<functionValues->GetMaxSpectralValue()<<std::endl; - fout <<" ---------------------------------------------------------"<<std::endl; - fout<<"Input wavelenght band values ["<<functionValues->GetFilterFunctionValues().size()<<"]:"<<std::endl; - for (unsigned int i=0; i<functionValues->GetFilterFunctionValues().size(); i++) - { - fout<< " "<<functionValues->GetFilterFunctionValues()[i] <<std::endl; - } - fout <<" ---------------------------------------------------------"<<std::endl; - fout<<"Output wavelenght band values 6S ["<<functionValues->GetFilterFunctionValues6S().size()<<"]:"<<std::endl; - for (unsigned int i=0; i<functionValues->GetFilterFunctionValues6S().size(); i++) - { - fout<< " "<<functionValues->GetFilterFunctionValues6S()[i] <<std::endl; - } - fout<<std::endl; + fout << " ---------------------------------------------------------" << std::endl; + fout << "Inputs values:" << std::setprecision(10) << std::endl; + fout << " -----> SolarZenithalAngle : " << solarZenithalAngle << std::endl; + fout << " -----> SolarAzimutalAngle : " << solarAzimutalAngle << std::endl; + fout << " -----> ViewingZenithalAngle : " << viewingZenithalAngle << std::endl; + fout << " -----> ViewingAzimutalAngle : " << viewingAzimutalAngle << std::endl; + fout << " -----> Month : " << month << std::endl; + fout << " -----> Day : " << day << std::endl; + fout << " -----> AtmosphericPressure : " << atmosphericPressure << std::endl; + fout << " -----> WaterVaporAmount : " << waterVaporAmount << std::endl; + fout << " -----> OzoneAmount : " << ozoneAmount << std::endl; + fout << " -----> AerosolModel : " << aer << std::endl; + fout << " -----> AerosolOptical : " << aerosolOptical << std::endl; + fout << " -----> MinSpectralValue : " << minSpectralValue << std::endl; + fout << " -----> MaxSpectralValue : " << maxSpectralValue << std::endl; + fout << " -----> UserStep : " << functionValues->GetUserStep() << std::endl; + fout << " ---------------------------------------------------------" << std::endl; + fout << "Outputs values:" << std::endl; + fout << " -----> atmospheric reflectance : " << + radiative->GetIntrinsicAtmosphericReflectance(0) << std::endl; + fout << " -----> atmospheric spherical albedo : " << radiative->GetSphericalAlbedo(0) << + std::endl; + fout << " -----> total gaseous transmission : " << + radiative->GetTotalGaseousTransmission(0) << std::endl; + fout << " -----> downward transmittance : " << radiative->GetDownwardTransmittance(0) << + std::endl; + fout << " -----> upward transmittance : " << radiative->GetUpwardTransmittance(0) << + std::endl; + fout << " -----> upward diffuse transmittance : " << + radiative->GetUpwardDiffuseTransmittance(0) << std::endl; + fout << " -----> upward direct transmittance : " << + radiative->GetUpwardDirectTransmittance(0) << std::endl; + fout << " -----> upward diffuse transmittance for rayleigh : " << + radiative->GetUpwardDiffuseTransmittanceForRayleigh(0) << std::endl; + fout << " -----> upward diffuse transmittance for aerosols : " << + radiative->GetUpwardDiffuseTransmittanceForAerosol(0) << std::endl; + fout << " -----> MinSpectralValue update: " << functionValues->GetMinSpectralValue() << + std::endl; + fout << " -----> MaxSpectralValue update : " << functionValues->GetMaxSpectralValue() << + std::endl; + fout << " ---------------------------------------------------------" << std::endl; + fout << "Input wavelenght band values [" << functionValues->GetFilterFunctionValues().size() << "]:" << std::endl; + for (unsigned int i = 0; i < functionValues->GetFilterFunctionValues().size(); i++) + { + fout << " " << functionValues->GetFilterFunctionValues()[i] << std::endl; + } + fout << " ---------------------------------------------------------" << std::endl; + fout << "Output wavelenght band values 6S [" << functionValues->GetFilterFunctionValues6S().size() << "]:" << + std::endl; + for (unsigned int i = 0; i < functionValues->GetFilterFunctionValues6S().size(); i++) + { + fout << " " << functionValues->GetFilterFunctionValues6S()[i] << std::endl; + } + fout << std::endl; fout.close(); return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx b/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx index 810e2ca6c2..64cb01e02c 100644 --- a/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx +++ b/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx @@ -21,9 +21,11 @@ int otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew(int argc, char * argv[]) { - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType; + typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms + AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType; // Instantiating object - AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType::Pointer object = AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType::New(); + AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType::Pointer object = + AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbAtmosphericCorrectionSequencement.cxx b/Testing/Code/Radiometry/otbAtmosphericCorrectionSequencement.cxx index 179bc6859d..363ed2c367 100644 --- a/Testing/Code/Radiometry/otbAtmosphericCorrectionSequencement.cxx +++ b/Testing/Code/Radiometry/otbAtmosphericCorrectionSequencement.cxx @@ -23,7 +23,6 @@ #define ITK_LEAN_AND_MEAN #endif - #include "otbImageToLuminanceImageFilter.h" #include "otbLuminanceToReflectanceImageFilter.h" #include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" @@ -32,33 +31,34 @@ #include "otbReflectanceToSurfaceReflectanceImageFilter.h" #include "otbSurfaceAdjencyEffect6SCorrectionSchemeFilter.h" - #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include <string> -int otbAtmosphericCorrectionSequencementTest( int argc, char *argv[] ) +int otbAtmosphericCorrectionSequencementTest(int argc, char *argv[]) { - if ( argc != 19 ) - { + if (argc != 19) + { std::cerr << "Missing Parameters " << std::endl; std::cerr << "Usage: " << argv[0]; std::cerr << " inputImage , outputImage," << std::endl; std::cerr << " alphaBetaFileName , solarZenithalAngle , day, month , solarIlluminationFileName," << std::endl; std::cerr << " solarAzimutalAngle , viewingZenithalAngle , viewingAzimutalAngle," << std::endl; - std::cerr << " atmosphericPressure , waterVaporAmount , ozoneAmount , aerosolModel , AerosolOptical," << std::endl; - std::cerr << " wavelenghtSpectralBandFileName , adjencyEffect6SCorrectionWindowRadius, pixelSpacingInKilometers" << std::endl; + std::cerr << " atmosphericPressure , waterVaporAmount , ozoneAmount , aerosolModel , AerosolOptical," << + std::endl; + std::cerr << + " wavelenghtSpectralBandFileName , adjencyEffect6SCorrectionWindowRadius, pixelSpacingInKilometers" << std::endl; std::cerr << std::endl; return 1; - } + } - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> ImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -67,10 +67,9 @@ int otbAtmosphericCorrectionSequencementTest( int argc, char *argv[] ) unsigned int nbOfComponent = reader->GetOutput()->GetNumberOfComponentsPerPixel(); - //------------------------------- - typedef otb::ImageToLuminanceImageFilter<ImageType,ImageType> + typedef otb::ImageToLuminanceImageFilter<ImageType, ImageType> ImageToLuminanceImageFilterType; typedef ImageToLuminanceImageFilterType::VectorType VectorType; @@ -82,13 +81,13 @@ int otbAtmosphericCorrectionSequencementTest( int argc, char *argv[] ) std::ifstream fin; fin.open(argv[3]); double dalpha(0.), dbeta(0.); - for ( unsigned int i=0; i < nbOfComponent; i++) - { + for (unsigned int i = 0; i < nbOfComponent; i++) + { fin >> dalpha; fin >> dbeta; alpha[i] = dalpha; beta[i] = dbeta; - } + } fin.close(); ImageToLuminanceImageFilterType::Pointer filterImageToLuminance = ImageToLuminanceImageFilterType::New(); @@ -96,9 +95,8 @@ int otbAtmosphericCorrectionSequencementTest( int argc, char *argv[] ) filterImageToLuminance->SetBeta(beta); filterImageToLuminance->SetInput(reader->GetOutput()); - //------------------------------- - typedef otb::LuminanceToReflectanceImageFilter<ImageType,ImageType> + typedef otb::LuminanceToReflectanceImageFilter<ImageType, ImageType> LuminanceToReflectanceImageFilterType; typedef LuminanceToReflectanceImageFilterType::VectorType VectorType; @@ -108,15 +106,15 @@ int otbAtmosphericCorrectionSequencementTest( int argc, char *argv[] ) fin.open(argv[7]); double dsolarIllumination(0.); - for ( unsigned int i=0; i < nbOfComponent; i++) - { + for (unsigned int i = 0; i < nbOfComponent; i++) + { fin >> dsolarIllumination; solarIllumination[i] = dsolarIllumination; - } + } fin.close(); - - LuminanceToReflectanceImageFilterType::Pointer filterLuminanceToReflectance = LuminanceToReflectanceImageFilterType::New(); + LuminanceToReflectanceImageFilterType::Pointer filterLuminanceToReflectance = + LuminanceToReflectanceImageFilterType::New(); const int day(atoi(argv[5])); const int month(atoi(argv[6])); @@ -141,46 +139,45 @@ int otbAtmosphericCorrectionSequencementTest( int argc, char *argv[] ) typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; - - AtmosphericCorrectionParametersType::Pointer dataAtmosphericCorrectionParameters = AtmosphericCorrectionParametersType::New(); - AtmosphericRadiativeTermsType::Pointer dataAtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); + AtmosphericCorrectionParametersType::Pointer dataAtmosphericCorrectionParameters = + AtmosphericCorrectionParametersType::New(); + AtmosphericRadiativeTermsType::Pointer dataAtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); double minSpectralValue(0.); double maxSpectralValue(0.); double userStep(0.); double value(0.); - unsigned int nbBands(0); - unsigned int nbValuesPerBand(0); - std::string sString; + unsigned int nbBands(0); + unsigned int nbValuesPerBand(0); + std::string sString; ValuesVectorType valuesVector; fin.open(argv[16]); fin >> nbBands; - for (unsigned int i=0; i<nbBands; i++) - { + for (unsigned int i = 0; i < nbBands; i++) + { valuesVector.clear(); fin >> sString; fin >> minSpectralValue; fin >> maxSpectralValue; fin >> userStep; fin >> nbValuesPerBand; - for ( unsigned int j=0; j < nbValuesPerBand; j++) - { + for (unsigned int j = 0; j < nbValuesPerBand; j++) + { fin >> value; valuesVector.push_back(value); - } + } FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New(); functionValues->SetFilterFunctionValues(valuesVector); functionValues->SetMinSpectralValue(minSpectralValue); functionValues->SetMaxSpectralValue(maxSpectralValue); - functionValues->SetUserStep( userStep ); + functionValues->SetUserStep(userStep); dataAtmosphericCorrectionParameters->SetWavelenghtSpectralBandWithIndex(i, functionValues); - } + } fin.close(); - // Set parameters dataAtmosphericCorrectionParameters->SetSolarZenithalAngle(filterLuminanceToReflectance->GetZenithalSolarAngle()); dataAtmosphericCorrectionParameters->SetSolarAzimutalAngle(static_cast<double>(atof(argv[8]))); @@ -195,27 +192,37 @@ int otbAtmosphericCorrectionSequencementTest( int argc, char *argv[] ) dataAtmosphericCorrectionParameters->SetAerosolModel(aerosolModel); dataAtmosphericCorrectionParameters->SetAerosolOptical(static_cast<double>(atof(argv[15]))); - AtmosphericCorrectionParametersTo6SRadiativeTermsType::Pointer filterAtmosphericCorrectionParametersTo6SRadiativeTerms = AtmosphericCorrectionParametersTo6SRadiativeTermsType::New(); - filterAtmosphericCorrectionParametersTo6SRadiativeTerms->SetInput( dataAtmosphericCorrectionParameters ); + AtmosphericCorrectionParametersTo6SRadiativeTermsType::Pointer + filterAtmosphericCorrectionParametersTo6SRadiativeTerms = + AtmosphericCorrectionParametersTo6SRadiativeTermsType::New(); + filterAtmosphericCorrectionParametersTo6SRadiativeTerms->SetInput(dataAtmosphericCorrectionParameters); filterAtmosphericCorrectionParametersTo6SRadiativeTerms->Update(); //------------------------------- - typedef otb::ReflectanceToSurfaceReflectanceImageFilter<ImageType, ImageType> ReflectanceToSurfaceReflectanceImageFilterType; - ReflectanceToSurfaceReflectanceImageFilterType::Pointer filterReflectanceToSurfaceReflectanceImageFilter = ReflectanceToSurfaceReflectanceImageFilterType::New(); + typedef otb::ReflectanceToSurfaceReflectanceImageFilter<ImageType, + ImageType> ReflectanceToSurfaceReflectanceImageFilterType; + ReflectanceToSurfaceReflectanceImageFilterType::Pointer filterReflectanceToSurfaceReflectanceImageFilter = + ReflectanceToSurfaceReflectanceImageFilterType::New(); - filterReflectanceToSurfaceReflectanceImageFilter->SetAtmosphericRadiativeTerms( filterAtmosphericCorrectionParametersTo6SRadiativeTerms->GetOutput() ); + filterReflectanceToSurfaceReflectanceImageFilter->SetAtmosphericRadiativeTerms( + filterAtmosphericCorrectionParametersTo6SRadiativeTerms->GetOutput()); filterReflectanceToSurfaceReflectanceImageFilter->SetInput(filterLuminanceToReflectance->GetOutput()); //------------------------------- - typedef otb::SurfaceAdjencyEffect6SCorrectionSchemeFilter<ImageType, ImageType> SurfaceAdjencyEffect6SCorrectionSchemeFilterType; - SurfaceAdjencyEffect6SCorrectionSchemeFilterType::Pointer filterSurfaceAdjencyEffect6SCorrectionSchemeFilter = SurfaceAdjencyEffect6SCorrectionSchemeFilterType::New(); + typedef otb::SurfaceAdjencyEffect6SCorrectionSchemeFilter<ImageType, + ImageType> SurfaceAdjencyEffect6SCorrectionSchemeFilterType; + SurfaceAdjencyEffect6SCorrectionSchemeFilterType::Pointer filterSurfaceAdjencyEffect6SCorrectionSchemeFilter = + SurfaceAdjencyEffect6SCorrectionSchemeFilterType::New(); - filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->SetAtmosphericRadiativeTerms(filterAtmosphericCorrectionParametersTo6SRadiativeTerms->GetOutput()); + filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->SetAtmosphericRadiativeTerms( + filterAtmosphericCorrectionParametersTo6SRadiativeTerms->GetOutput()); filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->SetWindowRadius(atoi(argv[17])); filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->SetPixelSpacingInKilometers(static_cast<double>(atof(argv[18]))); - filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->SetZenithalViewingAngle(dataAtmosphericCorrectionParameters->GetViewingZenithalAngle()); - filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->SetInput(filterReflectanceToSurfaceReflectanceImageFilter->GetOutput()); + filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->SetZenithalViewingAngle( + dataAtmosphericCorrectionParameters->GetViewingZenithalAngle()); + filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->SetInput( + filterReflectanceToSurfaceReflectanceImageFilter->GetOutput()); //------------------------------- WriterType::Pointer writer = WriterType::New(); @@ -223,7 +230,5 @@ int otbAtmosphericCorrectionSequencementTest( int argc, char *argv[] ) writer->SetInput(filterSurfaceAdjencyEffect6SCorrectionSchemeFilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Radiometry/otbAtmosphericRadiativeTermsNew.cxx b/Testing/Code/Radiometry/otbAtmosphericRadiativeTermsNew.cxx index f62b0bbe41..9dbf66763b 100644 --- a/Testing/Code/Radiometry/otbAtmosphericRadiativeTermsNew.cxx +++ b/Testing/Code/Radiometry/otbAtmosphericRadiativeTermsNew.cxx @@ -25,7 +25,7 @@ int otbAtmosphericRadiativeTermsNew(int argc, char * argv[]) { - typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; // Instantiating object AtmosphericRadiativeTermsType::Pointer object = AtmosphericRadiativeTermsType::New(); diff --git a/Testing/Code/Radiometry/otbDEMCaracteristicsExtractor.cxx b/Testing/Code/Radiometry/otbDEMCaracteristicsExtractor.cxx index 25e5c643d3..a74c26fdd9 100644 --- a/Testing/Code/Radiometry/otbDEMCaracteristicsExtractor.cxx +++ b/Testing/Code/Radiometry/otbDEMCaracteristicsExtractor.cxx @@ -22,7 +22,6 @@ #include "otbStreamingImageFileWriter.h" #include "otbImageFileReader.h" - int otbDEMCaracteristicsExtractor(int argc, char * argv[]) { const char * inputFileName = argv[1]; @@ -31,20 +30,19 @@ int otbDEMCaracteristicsExtractor(int argc, char * argv[]) const char * outputIncidenceFileName = argv[8]; const char * outputExitanceFileName = argv[9]; - const unsigned int Dimension = 2; - typedef double PixelType; + typedef double PixelType; typedef otb::Image<PixelType, Dimension> InputImageType; - typedef otb::DEMCaracteristicsExtractor< InputImageType, InputImageType > DEMCaracteristicsExtractorType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::StreamingImageFileWriter<InputImageType> WriterType; + typedef otb::DEMCaracteristicsExtractor<InputImageType, InputImageType> DEMCaracteristicsExtractorType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::StreamingImageFileWriter<InputImageType> WriterType; - ReaderType::Pointer input = ReaderType::New(); - WriterType::Pointer slotWriter = WriterType::New(); - WriterType::Pointer aspectWriter = WriterType::New(); - WriterType::Pointer incidenceWriter = WriterType::New(); - WriterType::Pointer exitanceWriter = WriterType::New(); + ReaderType::Pointer input = ReaderType::New(); + WriterType::Pointer slotWriter = WriterType::New(); + WriterType::Pointer aspectWriter = WriterType::New(); + WriterType::Pointer incidenceWriter = WriterType::New(); + WriterType::Pointer exitanceWriter = WriterType::New(); DEMCaracteristicsExtractorType::Pointer filter = DEMCaracteristicsExtractorType::New(); slotWriter->SetNumberOfStreamDivisions(1); diff --git a/Testing/Code/Radiometry/otbDEMCaracteristicsExtractorNew.cxx b/Testing/Code/Radiometry/otbDEMCaracteristicsExtractorNew.cxx index 5fe3c620eb..fabd32c042 100644 --- a/Testing/Code/Radiometry/otbDEMCaracteristicsExtractorNew.cxx +++ b/Testing/Code/Radiometry/otbDEMCaracteristicsExtractorNew.cxx @@ -20,13 +20,12 @@ #include "otbDEMCaracteristicsExtractor.h" #include "otbImage.h" - int otbDEMCaracteristicsExtractorNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType, Dimension> InputImageType; - typedef otb::DEMCaracteristicsExtractor< InputImageType, InputImageType > DEMCaracteristicsExtractorType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputImageType; + typedef otb::DEMCaracteristicsExtractor<InputImageType, InputImageType> DEMCaracteristicsExtractorType; DEMCaracteristicsExtractorType::Pointer filter = DEMCaracteristicsExtractorType::New(); diff --git a/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx index 3faa737fc3..be19dc1be3 100644 --- a/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx @@ -24,18 +24,18 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - template<class TInputImage, class TOutputImage, class TFunction> int generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputImage> ReaderType; + typedef otb::ImageFileReader<TInputImage> ReaderType; typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::MultiChannelRAndBAndNIRIndexImageFilter<TInputImage,TOutputImage,TFunction> + typedef otb::MultiChannelRAndBAndNIRIndexImageFilter<TInputImage, TOutputImage, TFunction> MultiChannelRAndBAndNIRIndexImageFilterType; // Instantiating object - typename MultiChannelRAndBAndNIRIndexImageFilterType::Pointer filter = MultiChannelRAndBAndNIRIndexImageFilterType::New(); + typename MultiChannelRAndBAndNIRIndexImageFilterType::Pointer filter = + MultiChannelRAndBAndNIRIndexImageFilterType::New(); typename ReaderType::Pointer reader = ReaderType::New(); typename WriterType::Pointer writer = WriterType::New(); @@ -51,18 +51,18 @@ int generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char double c2(::atof(argv[8])); double l(::atof(argv[9])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetRedIndex(redChannel); filter->SetBlueIndex(blueChannel); filter->SetNIRIndex(nirChannel); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); filter->GetFunctor().SetG(g); filter->GetFunctor().SetC1(c1); filter->GetFunctor().SetC2(c2); filter->GetFunctor().SetL(l); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; @@ -71,19 +71,22 @@ int generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char int otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "EVI" ) return( generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::EVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else - return EXIT_FAILURE; + if (strArgv == "EVI") + return (generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::EVI<InputImageType:: + InternalPixelType, + InputImageType:: + InternalPixelType, + InputImageType:: + InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx index ef05ceaf0e..04e794ace2 100644 --- a/Testing/Code/Radiometry/otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx @@ -23,16 +23,15 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - template<class TInputRImage, class TInputBImage, class TInputNIRImage, class TOutputImage, class TFunction> int generic_EVIRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputRImage> RReaderType; - typedef otb::ImageFileReader<TInputBImage> BReaderType; + typedef otb::ImageFileReader<TInputRImage> RReaderType; + typedef otb::ImageFileReader<TInputBImage> BReaderType; typedef otb::ImageFileReader<TInputNIRImage> NIRReaderType; - typedef otb::ImageFileWriter<TOutputImage> WriterType; + typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::RAndBAndNIRIndexImageFilter<TInputRImage,TInputBImage,TInputNIRImage,TOutputImage,TFunction> + typedef otb::RAndBAndNIRIndexImageFilter<TInputRImage, TInputBImage, TInputNIRImage, TOutputImage, TFunction> RAndBAndNIRIndexImageFilterType; // Instantiating object @@ -46,25 +45,25 @@ int generic_EVIRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) const char * inputFilenameB = argv[2]; const char * inputFilenameNIR = argv[3]; const char * outputFilename = argv[4]; - double g(::atof(argv[5])); - double c1(::atof(argv[6])); - double c2(::atof(argv[7])); - double l(::atof(argv[8])); - - readerR->SetFileName( inputFilenameR ); - readerB->SetFileName( inputFilenameB ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputB( readerB->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); + double g(::atof(argv[5])); + double c1(::atof(argv[6])); + double c2(::atof(argv[7])); + double l(::atof(argv[8])); + + readerR->SetFileName(inputFilenameR); + readerB->SetFileName(inputFilenameB); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputB(readerB->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); filter->GetFunctor().SetG(g); filter->GetFunctor().SetC1(c1); filter->GetFunctor().SetC2(c2); filter->GetFunctor().SetL(l); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; @@ -73,22 +72,23 @@ int generic_EVIRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) int otbEVIRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputBImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputBImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "EVI" ) return( generic_EVIRAndBAndNIRVegetationIndexImageFilter<InputRImageType, InputBImageType, InputNIRImageType, OutputImageType, - otb::Functor::EVI< InputRImageType::PixelType, - InputBImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else - return EXIT_FAILURE; + if (strArgv == "EVI") + return (generic_EVIRAndBAndNIRVegetationIndexImageFilter<InputRImageType, InputBImageType, InputNIRImageType, + OutputImageType, + otb::Functor::EVI<InputRImageType::PixelType, + InputBImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbFilterFunctionValues.cxx b/Testing/Code/Radiometry/otbFilterFunctionValues.cxx index d65547acb7..29933e3cc1 100644 --- a/Testing/Code/Radiometry/otbFilterFunctionValues.cxx +++ b/Testing/Code/Radiometry/otbFilterFunctionValues.cxx @@ -27,18 +27,18 @@ int otbFilterFunctionValuesTest(int argc, char * argv[]) { - char * outname = argv[1]; + char * outname = argv[1]; const double SIXSStepOfWavelenghtSpectralBandValues(0.0025); typedef otb::FilterFunctionValues FilterFunctionValuesType; // Instantiating object - FilterFunctionValuesType::Pointer object = FilterFunctionValuesType::New(); + FilterFunctionValuesType::Pointer object = FilterFunctionValuesType::New(); FilterFunctionValuesType::ValuesVectorType vect; - for (int i=5; i<argc; i++) - { + for (int i = 5; i < argc; i++) + { vect.push_back(atof(argv[i])); - } + } object->SetMinSpectralValue(atof(argv[2])); object->SetMaxSpectralValue(atof(argv[3])); @@ -50,28 +50,26 @@ int otbFilterFunctionValuesTest(int argc, char * argv[]) SIXSStepOfWavelenghtSpectralBandValues, object); - // Writing output file std::ofstream file; file.open(outname); - file <<"Input Vector :"<<std::endl; - for (unsigned int i=0; i<vect.size(); i++) - { - file<< vect[i] <<std::endl; - } - file<<std::endl; - file<<"Output vector :"<<std::endl; - for (unsigned int i=0; i<object->GetFilterFunctionValues6S().size(); i++) - { - file<< object->GetFilterFunctionValues6S()[i] <<std::endl; - } - file<<std::endl; - file<<"L_min :"<<object->GetMinSpectralValue()<<std::endl; - file<<"L_max :"<<object->GetMaxSpectralValue()<<std::endl; + file << "Input Vector :" << std::endl; + for (unsigned int i = 0; i < vect.size(); i++) + { + file << vect[i] << std::endl; + } + file << std::endl; + file << "Output vector :" << std::endl; + for (unsigned int i = 0; i < object->GetFilterFunctionValues6S().size(); i++) + { + file << object->GetFilterFunctionValues6S()[i] << std::endl; + } + file << std::endl; + file << "L_min :" << object->GetMinSpectralValue() << std::endl; + file << "L_max :" << object->GetMaxSpectralValue() << std::endl; file.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbGAndRIndexImageFilter.cxx b/Testing/Code/Radiometry/otbGAndRIndexImageFilter.cxx index b944ee98d1..4f71e187ed 100644 --- a/Testing/Code/Radiometry/otbGAndRIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbGAndRIndexImageFilter.cxx @@ -30,7 +30,7 @@ int generic_GAndRIndexImageFilter(int argc, char * argv[]) typedef otb::ImageFileReader<TInputRImage> RReaderType; typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::GAndRIndexImageFilter<TInputGImage,TInputRImage,TOutputImage,TFunction> + typedef otb::GAndRIndexImageFilter<TInputGImage, TInputRImage, TOutputImage, TFunction> GAndRIndexImageFilterType; // Instantiating object @@ -43,46 +43,46 @@ int generic_GAndRIndexImageFilter(int argc, char * argv[]) const char * inputFilenameR = argv[2]; const char * outputFilename = argv[3]; - readerG->SetFileName( inputFilenameG ); - readerR->SetFileName( inputFilenameR ); - writer->SetFileName( outputFilename ); - filter->SetInputG( readerG->GetOutput() ); - filter->SetInputR( readerR->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + readerG->SetFileName(inputFilenameG); + readerR->SetFileName(inputFilenameR); + writer->SetFileName(outputFilename); + filter->SetInputG(readerG->GetOutput()); + filter->SetInputR(readerR->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - int otbGAndRIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> InputGImageType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> InputGImageType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "IR" ) return( generic_GAndRIndexImageFilter<InputGImageType, InputRImageType, OutputImageType, - otb::Functor::IR< InputRImageType::PixelType, - InputRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "IC" ) return( generic_GAndRIndexImageFilter<InputGImageType, InputRImageType, OutputImageType, - otb::Functor::IC< InputGImageType::PixelType, - InputRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "IB" ) return( generic_GAndRIndexImageFilter<InputGImageType, InputRImageType, OutputImageType, - otb::Functor::IB< InputGImageType::PixelType, - InputRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else - return EXIT_FAILURE; + if (strArgv == "IR") + return (generic_GAndRIndexImageFilter<InputGImageType, InputRImageType, OutputImageType, + otb::Functor::IR<InputRImageType::PixelType, + InputRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "IC") + return (generic_GAndRIndexImageFilter<InputGImageType, InputRImageType, OutputImageType, + otb::Functor::IC<InputGImageType::PixelType, + InputRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "IB") + return (generic_GAndRIndexImageFilter<InputGImageType, InputRImageType, OutputImageType, + otb::Functor::IB<InputGImageType::PixelType, + InputRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbGAndRIndexImageFilterNew.cxx b/Testing/Code/Radiometry/otbGAndRIndexImageFilterNew.cxx index 5c4afb8e0e..ebf60d91c8 100644 --- a/Testing/Code/Radiometry/otbGAndRIndexImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbGAndRIndexImageFilterNew.cxx @@ -28,12 +28,12 @@ int otbGAndRIndexImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> InputGImageType; - typedef itk::Image<PixelType,Dimension> InputRImageType; - typedef itk::Image<PixelType,Dimension> OutputImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> InputGImageType; + typedef itk::Image<PixelType, Dimension> InputRImageType; + typedef itk::Image<PixelType, Dimension> OutputImageType; - typedef otb::GAndRIndexImageFilter<InputGImageType,InputRImageType,OutputImageType> GAndRIndexImageFilterType; + typedef otb::GAndRIndexImageFilter<InputGImageType, InputRImageType, OutputImageType> GAndRIndexImageFilterType; // Instantiating object GAndRIndexImageFilterType::Pointer object = GAndRIndexImageFilterType::New(); diff --git a/Testing/Code/Radiometry/otbIBGAndRAndNIRIndexImageFilter.cxx b/Testing/Code/Radiometry/otbIBGAndRAndNIRIndexImageFilter.cxx index c5fa8ca78e..aff1bbf607 100644 --- a/Testing/Code/Radiometry/otbIBGAndRAndNIRIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbIBGAndRAndNIRIndexImageFilter.cxx @@ -23,58 +23,54 @@ #include "otbImageFileWriter.h" #include "otbSoilIndicesFunctor.h" - int otbIBGAndRAndNIRIndexImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputGImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; - - typedef otb::ImageFileReader<InputRImageType> RReaderType; - typedef otb::ImageFileReader<InputGImageType> GReaderType; - typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - typedef otb::Functor::IB2< InputGImageType::PixelType, - InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType > FunctorType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputGImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; + + typedef otb::ImageFileReader<InputRImageType> RReaderType; + typedef otb::ImageFileReader<InputGImageType> GReaderType; + typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + + typedef otb::Functor::IB2<InputGImageType::PixelType, + InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> FunctorType; // Warning : the order of the channels are not the same between the functor and the filter - typedef otb::RAndGAndNIRIndexImageFilter< InputRImageType, - InputGImageType, - InputNIRImageType, - OutputImageType, - FunctorType > RAndGAndNIRIndexImageFilterType; + typedef otb::RAndGAndNIRIndexImageFilter<InputRImageType, + InputGImageType, + InputNIRImageType, + OutputImageType, + FunctorType> RAndGAndNIRIndexImageFilterType; // Instantiating object RAndGAndNIRIndexImageFilterType::Pointer filter = RAndGAndNIRIndexImageFilterType::New(); - RReaderType::Pointer readerR = RReaderType::New(); - GReaderType::Pointer readerG = GReaderType::New(); - NIRReaderType::Pointer readerNIR = NIRReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - + RReaderType::Pointer readerR = RReaderType::New(); + GReaderType::Pointer readerG = GReaderType::New(); + NIRReaderType::Pointer readerNIR = NIRReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilenameR = argv[1]; const char * inputFilenameG = argv[2]; const char * inputFilenameNIR = argv[3]; const char * outputFilename = argv[4]; - readerR->SetFileName( inputFilenameR ); - readerG->SetFileName( inputFilenameG ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputG( readerG->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); + readerR->SetFileName(inputFilenameR); + readerG->SetFileName(inputFilenameG); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputG(readerG->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Radiometry/otbIBMultiChannelGAndRAndNIRIndexImageFilter.cxx b/Testing/Code/Radiometry/otbIBMultiChannelGAndRAndNIRIndexImageFilter.cxx index 4401e53bd0..64ba40255e 100644 --- a/Testing/Code/Radiometry/otbIBMultiChannelGAndRAndNIRIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbIBMultiChannelGAndRAndNIRIndexImageFilter.cxx @@ -24,27 +24,26 @@ #include "otbImageFileWriter.h" #include "otbSoilIndicesFunctor.h" - int otbIBMultiChannelGAndRAndNIRIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::IB2< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType > FunctorType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Functor::IB2<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> FunctorType; // Warning : the order of the channels are not the same between the functor and the filter - typedef otb::MultiChannelRAndGAndNIRIndexImageFilter<InputImageType,OutputImageType,FunctorType> - MultiChannelRAndGAndNIRIndexImageFilterType; + typedef otb::MultiChannelRAndGAndNIRIndexImageFilter<InputImageType, OutputImageType, FunctorType> + MultiChannelRAndGAndNIRIndexImageFilterType; // Instantiating object MultiChannelRAndGAndNIRIndexImageFilterType::Pointer filter = MultiChannelRAndGAndNIRIndexImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -53,17 +52,15 @@ int otbIBMultiChannelGAndRAndNIRIndexImageFilter(int argc, char * argv[]) unsigned int greenChannel(::atoi(argv[4])); unsigned int nirChannel(::atoi(argv[5])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetRedIndex(redChannel); filter->SetGreenIndex(greenChannel); filter->SetNIRIndex(nirChannel); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Radiometry/otbISUMultiChannelRAndNIRIndexImageFilter.cxx b/Testing/Code/Radiometry/otbISUMultiChannelRAndNIRIndexImageFilter.cxx index e5b021e2f6..f2fed7c457 100644 --- a/Testing/Code/Radiometry/otbISUMultiChannelRAndNIRIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbISUMultiChannelRAndNIRIndexImageFilter.cxx @@ -24,24 +24,23 @@ #include "otbImageFileWriter.h" #include "otbBuiltUpIndicesFunctor.h" - int otbISUMultiChannelRAndNIRIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::ISU < InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType > FunctorType; - typedef otb::MultiChannelRAndNIRIndexImageFilter<InputImageType,OutputImageType,FunctorType> - MultiChannelRAndNIRIndexImageFilterType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Functor::ISU <InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> FunctorType; + typedef otb::MultiChannelRAndNIRIndexImageFilter<InputImageType, OutputImageType, FunctorType> + MultiChannelRAndNIRIndexImageFilterType; // Instantiating object MultiChannelRAndNIRIndexImageFilterType::Pointer filter = MultiChannelRAndNIRIndexImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -49,22 +48,20 @@ int otbISUMultiChannelRAndNIRIndexImageFilter(int argc, char * argv[]) unsigned int redChannel(::atoi(argv[3])); unsigned int nirChannel(::atoi(argv[4])); - double a(::atof(argv[5])); - double b(::atof(argv[6])); + double a(::atof(argv[5])); + double b(::atof(argv[6])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetRedIndex(redChannel); filter->SetNIRIndex(nirChannel); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); filter->GetFunctor().SetA(a); filter->GetFunctor().SetB(b); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Radiometry/otbISURAndNIRIndexImageFilter.cxx b/Testing/Code/Radiometry/otbISURAndNIRIndexImageFilter.cxx index 19f4ba8ff5..e283f1ed2d 100644 --- a/Testing/Code/Radiometry/otbISURAndNIRIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbISURAndNIRIndexImageFilter.cxx @@ -23,55 +23,51 @@ #include "otbImageFileWriter.h" #include "otbBuiltUpIndicesFunctor.h" - int otbISURAndNIRIndexImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputRImageType> RReaderType; - typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<InputRImageType> RReaderType; + typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::ISU < InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType > FunctorType; + typedef otb::Functor::ISU <InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> FunctorType; - typedef otb::RAndNIRIndexImageFilter< InputRImageType, - InputNIRImageType, - OutputImageType, - FunctorType > RAndNIRIndexImageFilterType; + typedef otb::RAndNIRIndexImageFilter<InputRImageType, + InputNIRImageType, + OutputImageType, + FunctorType> RAndNIRIndexImageFilterType; // Instantiating object RAndNIRIndexImageFilterType::Pointer filter = RAndNIRIndexImageFilterType::New(); - RReaderType::Pointer readerR = RReaderType::New(); - NIRReaderType::Pointer readerNIR = NIRReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - + RReaderType::Pointer readerR = RReaderType::New(); + NIRReaderType::Pointer readerNIR = NIRReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilenameR = argv[1]; const char * inputFilenameNIR = argv[2]; const char * outputFilename = argv[3]; - double a(::atof(argv[4])); - double b(::atof(argv[5])); + double a(::atof(argv[4])); + double b(::atof(argv[5])); - readerR->SetFileName( inputFilenameR ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); + readerR->SetFileName(inputFilenameR); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); filter->GetFunctor().SetA(a); filter->GetFunctor().SetB(b); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Radiometry/otbImageToLuminanceImageFilter.cxx b/Testing/Code/Radiometry/otbImageToLuminanceImageFilter.cxx index 6a309e5486..845ae1fe5b 100644 --- a/Testing/Code/Radiometry/otbImageToLuminanceImageFilter.cxx +++ b/Testing/Code/Radiometry/otbImageToLuminanceImageFilter.cxx @@ -23,20 +23,19 @@ #include "otbImageFileWriter.h" #include "itkVariableLengthVector.h" - int otbImageToLuminanceImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToLuminanceImageFilter<InputImageType,OutputImageType> ImageToLuminanceImageFilterType; - typedef ImageToLuminanceImageFilterType::VectorType VectorType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageToLuminanceImageFilter<InputImageType, OutputImageType> ImageToLuminanceImageFilterType; + typedef ImageToLuminanceImageFilterType::VectorType VectorType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -51,12 +50,11 @@ int otbImageToLuminanceImageFilter(int argc, char * argv[]) alpha.Fill(0); beta.Fill(0); - for (unsigned int i=0;i<nbOfComponent;i++) - { - alpha[i] = static_cast<double>(atof(argv[i+3])); - beta[i] = static_cast<double>(atof(argv[i+7])); - } - + for (unsigned int i = 0; i < nbOfComponent; i++) + { + alpha[i] = static_cast<double>(atof(argv[i + 3])); + beta[i] = static_cast<double>(atof(argv[i + 7])); + } // Instantiating object ImageToLuminanceImageFilterType::Pointer filter = ImageToLuminanceImageFilterType::New(); @@ -66,6 +64,5 @@ int otbImageToLuminanceImageFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbImageToLuminanceImageFilterAuto.cxx b/Testing/Code/Radiometry/otbImageToLuminanceImageFilterAuto.cxx index 4e45e7a002..34c845295f 100644 --- a/Testing/Code/Radiometry/otbImageToLuminanceImageFilterAuto.cxx +++ b/Testing/Code/Radiometry/otbImageToLuminanceImageFilterAuto.cxx @@ -31,14 +31,14 @@ int otbImageToLuminanceImageFilterAuto(int argc, char * argv[]) const char * outputFileName = argv[2]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToLuminanceImageFilter<InputImageType,OutputImageType> ImageToLuminanceImageFilterType; - typedef ImageToLuminanceImageFilterType::VectorType VectorType; - typedef otb::MultiChannelExtractROI<PixelType,PixelType> RoiFilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageToLuminanceImageFilter<InputImageType, OutputImageType> ImageToLuminanceImageFilterType; + typedef ImageToLuminanceImageFilterType::VectorType VectorType; + typedef otb::MultiChannelExtractROI<PixelType, PixelType> RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -60,6 +60,5 @@ int otbImageToLuminanceImageFilterAuto(int argc, char * argv[]) writer->SetInput(roiFilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbImageToLuminanceImageFilterNew.cxx b/Testing/Code/Radiometry/otbImageToLuminanceImageFilterNew.cxx index 4f9902acc7..bc245414f4 100644 --- a/Testing/Code/Radiometry/otbImageToLuminanceImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbImageToLuminanceImageFilterNew.cxx @@ -20,14 +20,13 @@ #include "otbImageToLuminanceImageFilter.h" #include "otbVectorImage.h" - int otbImageToLuminanceImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; - typedef otb::ImageToLuminanceImageFilter<InputImageType,InputImageType> ImageToLuminanceImageFilterType; + typedef otb::ImageToLuminanceImageFilter<InputImageType, InputImageType> ImageToLuminanceImageFilterType; // Instantiating object ImageToLuminanceImageFilterType::Pointer filter = ImageToLuminanceImageFilterType::New(); diff --git a/Testing/Code/Radiometry/otbImageToReflectanceImageFilter.cxx b/Testing/Code/Radiometry/otbImageToReflectanceImageFilter.cxx index bead7c1a97..145f516a63 100644 --- a/Testing/Code/Radiometry/otbImageToReflectanceImageFilter.cxx +++ b/Testing/Code/Radiometry/otbImageToReflectanceImageFilter.cxx @@ -23,34 +23,33 @@ #include "otbImageFileWriter.h" #include "itkVariableLengthVector.h" - int otbImageToReflectanceImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; const double angle = static_cast<double>(atof(argv[3])); - double flux = 0.; - int day = 1; - int month = 1; + double flux = 0.; + int day = 1; + int month = 1; - if (argc==17) - { + if (argc == 17) + { flux = static_cast<double>(atof(argv[16])); - } + } else - { + { day = atoi(argv[16]); month = atoi(argv[17]); - } + } const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToReflectanceImageFilter<InputImageType,OutputImageType> ImageToReflectanceImageFilterType; - typedef ImageToReflectanceImageFilterType::VectorType VectorType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageToReflectanceImageFilter<InputImageType, OutputImageType> ImageToReflectanceImageFilterType; + typedef ImageToReflectanceImageFilterType::VectorType VectorType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -67,13 +66,12 @@ int otbImageToReflectanceImageFilter(int argc, char * argv[]) beta.Fill(0); solarIllumination.Fill(0); - for (unsigned int i=0; i<nbOfComponent; i++) - { - alpha[i] = static_cast<double>(atof(argv[i+4])); - beta[i] = static_cast<double>(atof(argv[i+8])); - solarIllumination[i] = static_cast<double>(atof(argv[i+12])); - } - + for (unsigned int i = 0; i < nbOfComponent; i++) + { + alpha[i] = static_cast<double>(atof(argv[i + 4])); + beta[i] = static_cast<double>(atof(argv[i + 8])); + solarIllumination[i] = static_cast<double>(atof(argv[i + 12])); + } // Instantiating object ImageToReflectanceImageFilterType::Pointer filter = ImageToReflectanceImageFilterType::New(); @@ -83,20 +81,19 @@ int otbImageToReflectanceImageFilter(int argc, char * argv[]) filter->SetZenithalSolarAngle(angle); filter->SetSolarIllumination(solarIllumination); - if (argc==17) - { + if (argc == 17) + { filter->SetFluxNormalizationCoefficient(flux); - } + } else - { + { filter->SetDay(day); filter->SetMonth(month); - } + } filter->SetInput(reader->GetOutput()); writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbImageToReflectanceImageFilterAuto.cxx b/Testing/Code/Radiometry/otbImageToReflectanceImageFilterAuto.cxx index d0fae3105b..84c8834a38 100644 --- a/Testing/Code/Radiometry/otbImageToReflectanceImageFilterAuto.cxx +++ b/Testing/Code/Radiometry/otbImageToReflectanceImageFilterAuto.cxx @@ -30,14 +30,14 @@ int otbImageToReflectanceImageFilterAuto(int argc, char * argv[]) const char * outputFileName = argv[2]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToReflectanceImageFilter<InputImageType,OutputImageType> ImageToReflectanceImageFilterType; - typedef ImageToReflectanceImageFilterType::VectorType VectorType; - typedef otb::MultiChannelExtractROI<PixelType,PixelType> RoiFilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageToReflectanceImageFilter<InputImageType, OutputImageType> ImageToReflectanceImageFilterType; + typedef ImageToReflectanceImageFilterType::VectorType VectorType; + typedef otb::MultiChannelExtractROI<PixelType, PixelType> RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -56,10 +56,8 @@ int otbImageToReflectanceImageFilterAuto(int argc, char * argv[]) roiFilter->SetSizeY(100); roiFilter->SetInput(filter->GetOutput()); - writer->SetInput(roiFilter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbImageToReflectanceImageFilterNew.cxx b/Testing/Code/Radiometry/otbImageToReflectanceImageFilterNew.cxx index df3c60a00f..341d96c471 100644 --- a/Testing/Code/Radiometry/otbImageToReflectanceImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbImageToReflectanceImageFilterNew.cxx @@ -20,14 +20,13 @@ #include "otbImageToReflectanceImageFilter.h" #include "otbVectorImage.h" - int otbImageToReflectanceImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; - typedef otb::ImageToReflectanceImageFilter<InputImageType,InputImageType> ImageToReflectanceImageFilterType; + typedef otb::ImageToReflectanceImageFilter<InputImageType, InputImageType> ImageToReflectanceImageFilterType; // Instantiating object ImageToReflectanceImageFilterType::Pointer filter = ImageToReflectanceImageFilterType::New(); diff --git a/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilter.cxx b/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilter.cxx index f44afa95a0..342d0df629 100644 --- a/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilter.cxx +++ b/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilter.cxx @@ -23,34 +23,33 @@ #include "otbImageFileWriter.h" #include "itkVariableLengthVector.h" - int otbLuminanceToReflectanceImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; const double angle = static_cast<double>(atof(argv[3])); - double flux = 0.; - int day = 1; - int month = 1; + double flux = 0.; + int day = 1; + int month = 1; - if (argc==9) - { + if (argc == 9) + { flux = static_cast<double>(atof(argv[8])); - } + } else - { + { day = atoi(argv[8]); month = atoi(argv[9]); - } + } const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::LuminanceToReflectanceImageFilter<InputImageType,OutputImageType> LuminanceToReflectanceImageFilterType; - typedef LuminanceToReflectanceImageFilterType::VectorType VectorType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::LuminanceToReflectanceImageFilter<InputImageType, OutputImageType> LuminanceToReflectanceImageFilterType; + typedef LuminanceToReflectanceImageFilterType::VectorType VectorType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -67,26 +66,24 @@ int otbLuminanceToReflectanceImageFilter(int argc, char * argv[]) solarIllumination[2] = static_cast<double>(atof(argv[6])); solarIllumination[3] = static_cast<double>(atof(argv[7])); - // Instantiating object LuminanceToReflectanceImageFilterType::Pointer filter = LuminanceToReflectanceImageFilterType::New(); filter->SetZenithalSolarAngle(angle); filter->SetSolarIllumination(solarIllumination); - if (argc==9) - { + if (argc == 9) + { filter->SetFluxNormalizationCoefficient(flux); - } + } else - { + { filter->SetDay(day); filter->SetMonth(month); - } + } filter->SetInput(reader->GetOutput()); writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterAuto.cxx b/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterAuto.cxx index 8ff450ce63..7610bf4df7 100644 --- a/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterAuto.cxx +++ b/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterAuto.cxx @@ -31,15 +31,16 @@ int otbLuminanceToReflectanceImageFilterAuto(int argc, char * argv[]) const char * outputFileName = argv[2]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToLuminanceImageFilter<InputImageType,OutputImageType> ImageToLuminanceImageFilterType; - typedef otb::LuminanceToReflectanceImageFilter<OutputImageType,OutputImageType> LuminanceToReflectanceImageFilterType; - typedef ImageToLuminanceImageFilterType::VectorType VectorType; - typedef otb::MultiChannelExtractROI<PixelType,PixelType> RoiFilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageToLuminanceImageFilter<InputImageType, OutputImageType> ImageToLuminanceImageFilterType; + typedef otb::LuminanceToReflectanceImageFilter<OutputImageType, + OutputImageType> LuminanceToReflectanceImageFilterType; + typedef ImageToLuminanceImageFilterType::VectorType VectorType; + typedef otb::MultiChannelExtractROI<PixelType, PixelType> RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); diff --git a/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterNew.cxx b/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterNew.cxx index 4d4df18720..b1acaa69bf 100644 --- a/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterNew.cxx @@ -20,18 +20,16 @@ #include "otbLuminanceToReflectanceImageFilter.h" #include "otbVectorImage.h" - int otbLuminanceToReflectanceImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; - typedef otb::LuminanceToReflectanceImageFilter<InputImageType,InputImageType> LuminanceToReflectanceImageFilterType; + typedef otb::LuminanceToReflectanceImageFilter<InputImageType, InputImageType> LuminanceToReflectanceImageFilterType; // Instantiating object LuminanceToReflectanceImageFilterType::Pointer filter = LuminanceToReflectanceImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilter.cxx b/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilter.cxx index d00f087419..4d02bc320f 100644 --- a/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilter.cxx @@ -24,14 +24,13 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - template<class TInputImage, class TOutputImage, class TFunction> int generic_MultiChannelGAndRIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputImage> ReaderType; + typedef otb::ImageFileReader<TInputImage> ReaderType; typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::MultiChannelGAndRIndexImageFilter<TInputImage,TOutputImage,TFunction> + typedef otb::MultiChannelGAndRIndexImageFilter<TInputImage, TOutputImage, TFunction> MultiChannelGAndRIndexImageFilterType; // Instantiating object @@ -43,12 +42,12 @@ int generic_MultiChannelGAndRIndexImageFilter(int argc, char * argv[]) const char * outputFilename = argv[2]; unsigned int greenChannel(::atoi(argv[3])); unsigned int redChannel(::atoi(argv[4])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetGreenIndex(greenChannel); filter->SetRedIndex(redChannel); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; @@ -57,28 +56,30 @@ int generic_MultiChannelGAndRIndexImageFilter(int argc, char * argv[]) int otbMultiChannelGAndRIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef otb::VectorImage<unsigned char, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "IR" ) return( generic_MultiChannelGAndRIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::IR< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "IC" ) return( generic_MultiChannelGAndRIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::IC< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "IB" ) return( generic_MultiChannelGAndRIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::IB< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else - return EXIT_FAILURE; + if (strArgv == "IR") + return (generic_MultiChannelGAndRIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::IR<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "IC") + return (generic_MultiChannelGAndRIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::IC<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "IB") + return (generic_MultiChannelGAndRIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::IB<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilterNew.cxx b/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilterNew.cxx index 788e62e586..33fa2b0038 100644 --- a/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilterNew.cxx @@ -24,9 +24,9 @@ int otbMultiChannelGAndRIndexImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char,Dimension> InputImageType; - typedef otb::Image<float,Dimension> OutputImageType; - typedef otb::MultiChannelGAndRIndexImageFilter<InputImageType,OutputImageType> MultiChannelGAndRIndexImageFilterType; + typedef otb::VectorImage<unsigned char, Dimension> InputImageType; + typedef otb::Image<float, Dimension> OutputImageType; + typedef otb::MultiChannelGAndRIndexImageFilter<InputImageType, OutputImageType> MultiChannelGAndRIndexImageFilterType; // Instantiating object MultiChannelGAndRIndexImageFilterType::Pointer object = MultiChannelGAndRIndexImageFilterType::New(); diff --git a/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx index 3c4bf747be..54862a6d12 100644 --- a/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx @@ -27,14 +27,15 @@ template<class TInputImage, class TOutputImage, class TFunction> int generic_MultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputImage> ReaderType; + typedef otb::ImageFileReader<TInputImage> ReaderType; typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::MultiChannelRAndBAndNIRIndexImageFilter<TInputImage,TOutputImage,TFunction> + typedef otb::MultiChannelRAndBAndNIRIndexImageFilter<TInputImage, TOutputImage, TFunction> MultiChannelRAndBAndNIRIndexImageFilterType; // Instantiating object - typename MultiChannelRAndBAndNIRIndexImageFilterType::Pointer filter = MultiChannelRAndBAndNIRIndexImageFilterType::New(); + typename MultiChannelRAndBAndNIRIndexImageFilterType::Pointer filter = + MultiChannelRAndBAndNIRIndexImageFilterType::New(); typename ReaderType::Pointer reader = ReaderType::New(); typename WriterType::Pointer writer = WriterType::New(); @@ -43,38 +44,40 @@ int generic_MultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * a unsigned int redChannel(::atoi(argv[3])); unsigned int blueChannel(::atoi(argv[4])); unsigned int nirChannel(::atoi(argv[5])); - double gamma(::atof(argv[6])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + double gamma(::atof(argv[6])); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetRedIndex(redChannel); filter->SetBlueIndex(blueChannel); filter->SetNIRIndex(nirChannel); filter->GetFunctor().SetGamma(gamma); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } int otbMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "ARVI" ) return( generic_MultiChannelRAndBAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::ARVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else - return EXIT_FAILURE; + if (strArgv == "ARVI") + return (generic_MultiChannelRAndBAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::ARVI<InputImageType:: + InternalPixelType, + InputImageType:: + InternalPixelType, + InputImageType:: + InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew.cxx b/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew.cxx index 79a3dde686..680349db96 100644 --- a/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew.cxx @@ -21,17 +21,16 @@ #include "otbImage.h" #include "otbVectorImage.h" - int otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char,Dimension> InputImageType; - typedef otb::Image<float,Dimension> OutputImageType; - typedef otb::MultiChannelRAndBAndNIRIndexImageFilter<InputImageType,OutputImageType> MultiChannelRAndBAndNIRIndexImageFilterType; + typedef otb::VectorImage<unsigned char, Dimension> InputImageType; + typedef otb::Image<float, Dimension> OutputImageType; + typedef otb::MultiChannelRAndBAndNIRIndexImageFilter<InputImageType, + OutputImageType> MultiChannelRAndBAndNIRIndexImageFilterType; // Instantiating object MultiChannelRAndBAndNIRIndexImageFilterType::Pointer object = MultiChannelRAndBAndNIRIndexImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbMultiChannelRAndGAndNIRIndexImageFilterNew.cxx b/Testing/Code/Radiometry/otbMultiChannelRAndGAndNIRIndexImageFilterNew.cxx index 194be8acd6..570413e7e3 100644 --- a/Testing/Code/Radiometry/otbMultiChannelRAndGAndNIRIndexImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelRAndGAndNIRIndexImageFilterNew.cxx @@ -21,17 +21,16 @@ #include "otbImage.h" #include "otbVectorImage.h" - int otbMultiChannelRAndGAndNIRIndexImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char,Dimension> InputImageType; - typedef otb::Image<float,Dimension> OutputImageType; - typedef otb::MultiChannelRAndGAndNIRIndexImageFilter<InputImageType,OutputImageType> MultiChannelRAndGAndNIRIndexImageFilterType; + typedef otb::VectorImage<unsigned char, Dimension> InputImageType; + typedef otb::Image<float, Dimension> OutputImageType; + typedef otb::MultiChannelRAndGAndNIRIndexImageFilter<InputImageType, + OutputImageType> MultiChannelRAndGAndNIRIndexImageFilterType; // Instantiating object MultiChannelRAndGAndNIRIndexImageFilterType::Pointer object = MultiChannelRAndGAndNIRIndexImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.cxx index 017a7bc2a9..021c53ca9e 100644 --- a/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.cxx @@ -24,14 +24,13 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - template<class TInputImage, class TOutputImage, class TFunction> int generic_MultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputImage> ReaderType; + typedef otb::ImageFileReader<TInputImage> ReaderType; typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::MultiChannelRAndNIRIndexImageFilter<TInputImage,TOutputImage,TFunction> + typedef otb::MultiChannelRAndNIRIndexImageFilter<TInputImage, TOutputImage, TFunction> MultiChannelRAndNIRIndexImageFilterType; // Instantiating object @@ -43,12 +42,12 @@ int generic_MultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[ const char * outputFilename = argv[2]; unsigned int redChannel(::atoi(argv[3])); unsigned int nirChannel(::atoi(argv[4])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetRedIndex(redChannel); filter->SetNIRIndex(nirChannel); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; @@ -57,58 +56,68 @@ int generic_MultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[ int otbMultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef otb::VectorImage<unsigned char, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "NDVI" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::NDVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "RVI" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::RVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "SAVI" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::SAVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "TSAVI" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::TSAVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "MSAVI" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::MSAVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "MSAVI2" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::MSAVI2< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "GEMI" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::GEMI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "IPVI" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::IPVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "TNDVI" ) return( generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::TNDVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else - return EXIT_FAILURE; + if (strArgv == "NDVI") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::NDVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "RVI") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::RVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "SAVI") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::SAVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "TSAVI") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::TSAVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "MSAVI") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::MSAVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "MSAVI2") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::MSAVI2<InputImageType:: + InternalPixelType, + InputImageType:: + InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "GEMI") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::GEMI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "IPVI") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::IPVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "TNDVI") + return (generic_MultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::TNDVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv)); + else return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilterNew.cxx b/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilterNew.cxx index dd59e1cbb6..220901a437 100644 --- a/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilterNew.cxx @@ -24,9 +24,10 @@ int otbMultiChannelRAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char,Dimension> InputImageType; - typedef otb::Image<float,Dimension> OutputImageType; - typedef otb::MultiChannelRAndNIRIndexImageFilter<InputImageType,OutputImageType> MultiChannelRAndNIRIndexImageFilterType; + typedef otb::VectorImage<unsigned char, Dimension> InputImageType; + typedef otb::Image<float, Dimension> OutputImageType; + typedef otb::MultiChannelRAndNIRIndexImageFilter<InputImageType, + OutputImageType> MultiChannelRAndNIRIndexImageFilterType; // Instantiating object MultiChannelRAndNIRIndexImageFilterType::Pointer object = MultiChannelRAndNIRIndexImageFilterType::New(); diff --git a/Testing/Code/Radiometry/otbNDBIMultiChannelTM4AndTM5IndexImageFilter.cxx b/Testing/Code/Radiometry/otbNDBIMultiChannelTM4AndTM5IndexImageFilter.cxx index 374fef5a3b..371d83d22b 100644 --- a/Testing/Code/Radiometry/otbNDBIMultiChannelTM4AndTM5IndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbNDBIMultiChannelTM4AndTM5IndexImageFilter.cxx @@ -24,25 +24,24 @@ #include "otbImageFileWriter.h" #include "otbBuiltUpIndicesFunctor.h" - int otbNDBIMultiChannelTM4AndTM5IndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::NDBI < InputImageType::InternalPixelType, + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Functor::NDBI <InputImageType::InternalPixelType, InputImageType::InternalPixelType, - OutputImageType::PixelType > FunctorType; + OutputImageType::PixelType> FunctorType; - typedef itk::UnaryFunctorImageFilter<InputImageType,OutputImageType,FunctorType> - UnaryFunctorImageFilterType; + typedef itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType> + UnaryFunctorImageFilterType; // Instantiating object UnaryFunctorImageFilterType::Pointer filter = UnaryFunctorImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -50,18 +49,16 @@ int otbNDBIMultiChannelTM4AndTM5IndexImageFilter(int argc, char * argv[]) unsigned int tm4Channel(::atoi(argv[3])); unsigned int tm5Channel(::atoi(argv[4])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->GetFunctor().SetIndex1(tm4Channel); filter->GetFunctor().SetIndex2(tm5Channel); //filter->GetFunctor().SetTM5Index(tm5Channel); //filter->GetFunctor().SetTM4Index(tm4Channel); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Radiometry/otbNDBITM4AndTM5IndexImageFilter.cxx b/Testing/Code/Radiometry/otbNDBITM4AndTM5IndexImageFilter.cxx index b87fc763d0..d772cf48e5 100644 --- a/Testing/Code/Radiometry/otbNDBITM4AndTM5IndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbNDBITM4AndTM5IndexImageFilter.cxx @@ -23,49 +23,45 @@ #include "otbImageFileWriter.h" #include "otbBuiltUpIndicesFunctor.h" - int otbNDBITM4AndTM5IndexImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputTM4ImageType; - typedef otb::Image<PixelType,Dimension> InputTM5ImageType; - typedef otb::Image<double,Dimension> OutputImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputTM4ImageType; + typedef otb::Image<PixelType, Dimension> InputTM5ImageType; + typedef otb::Image<double, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputTM4ImageType> TM4ReaderType; - typedef otb::ImageFileReader<InputTM5ImageType> TM5ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<InputTM4ImageType> TM4ReaderType; + typedef otb::ImageFileReader<InputTM5ImageType> TM5ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::NDBI < InputTM4ImageType::PixelType, - InputTM5ImageType::PixelType, - OutputImageType::PixelType > FunctorType; + typedef otb::Functor::NDBI <InputTM4ImageType::PixelType, + InputTM5ImageType::PixelType, + OutputImageType::PixelType> FunctorType; - typedef itk::BinaryFunctorImageFilter< InputTM4ImageType, - InputTM5ImageType, - OutputImageType, - FunctorType > BinaryFunctorImageFilterType; + typedef itk::BinaryFunctorImageFilter<InputTM4ImageType, + InputTM5ImageType, + OutputImageType, + FunctorType> BinaryFunctorImageFilterType; // Instantiating object BinaryFunctorImageFilterType::Pointer filter = BinaryFunctorImageFilterType::New(); - TM4ReaderType::Pointer readerTM4 = TM4ReaderType::New(); - TM5ReaderType::Pointer readerTM5 = TM5ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - + TM4ReaderType::Pointer readerTM4 = TM4ReaderType::New(); + TM5ReaderType::Pointer readerTM5 = TM5ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilenameTM4 = argv[1]; const char * inputFilenameTM5 = argv[2]; const char * outputFilename = argv[3]; - readerTM4->SetFileName( inputFilenameTM4 ); - readerTM5->SetFileName( inputFilenameTM5 ); - writer->SetFileName( outputFilename ); - filter->SetInput1( readerTM4->GetOutput() ); - filter->SetInput2( readerTM5->GetOutput() ); + readerTM4->SetFileName(inputFilenameTM4); + readerTM5->SetFileName(inputFilenameTM5); + writer->SetFileName(outputFilename); + filter->SetInput1(readerTM4->GetOutput()); + filter->SetInput2(readerTM5->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Radiometry/otbNDWIMultiChannelWaterIndexImageFilter.cxx b/Testing/Code/Radiometry/otbNDWIMultiChannelWaterIndexImageFilter.cxx index d55ec36ae0..be55b48b77 100644 --- a/Testing/Code/Radiometry/otbNDWIMultiChannelWaterIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbNDWIMultiChannelWaterIndexImageFilter.cxx @@ -24,25 +24,24 @@ #include "otbImageFileWriter.h" #include "otbWaterIndicesFunctor.h" - int otbNDWIMultiChannelWaterIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::NDWI < InputImageType::InternalPixelType, + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Functor::NDWI <InputImageType::InternalPixelType, InputImageType::InternalPixelType, - OutputImageType::PixelType > FunctorType; + OutputImageType::PixelType> FunctorType; - typedef itk::UnaryFunctorImageFilter<InputImageType,OutputImageType,FunctorType> - UnaryFunctorImageFilterType; + typedef itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType> + UnaryFunctorImageFilterType; // Instantiating object UnaryFunctorImageFilterType::Pointer filter = UnaryFunctorImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -50,16 +49,14 @@ int otbNDWIMultiChannelWaterIndexImageFilter(int argc, char * argv[]) unsigned int nirChannel(::atoi(argv[3])); unsigned int mirChannel(::atoi(argv[4])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->GetFunctor().SetNIRIndex(nirChannel); filter->GetFunctor().SetMIRIndex(mirChannel); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Radiometry/otbNDWIWaterIndexImageFilter.cxx b/Testing/Code/Radiometry/otbNDWIWaterIndexImageFilter.cxx index cd416f8d28..dfa9fac758 100644 --- a/Testing/Code/Radiometry/otbNDWIWaterIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbNDWIWaterIndexImageFilter.cxx @@ -23,49 +23,45 @@ #include "otbImageFileWriter.h" #include "otbWaterIndicesFunctor.h" - int otbNDWIWaterIndexImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<PixelType,Dimension> InputMIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<PixelType, Dimension> InputMIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; - typedef otb::ImageFileReader<InputMIRImageType> MIRReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; + typedef otb::ImageFileReader<InputMIRImageType> MIRReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::NDWI < InputNIRImageType::PixelType, - InputMIRImageType::PixelType, - OutputImageType::PixelType > FunctorType; + typedef otb::Functor::NDWI <InputNIRImageType::PixelType, + InputMIRImageType::PixelType, + OutputImageType::PixelType> FunctorType; - typedef itk::BinaryFunctorImageFilter< InputNIRImageType, - InputMIRImageType, - OutputImageType, - FunctorType > BinaryFunctorImageFilterType; + typedef itk::BinaryFunctorImageFilter<InputNIRImageType, + InputMIRImageType, + OutputImageType, + FunctorType> BinaryFunctorImageFilterType; // Instantiating object BinaryFunctorImageFilterType::Pointer filter = BinaryFunctorImageFilterType::New(); - NIRReaderType::Pointer readerNIR = NIRReaderType::New(); - MIRReaderType::Pointer readerMIR = MIRReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - + NIRReaderType::Pointer readerNIR = NIRReaderType::New(); + MIRReaderType::Pointer readerMIR = MIRReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilenameNIR = argv[1]; const char * inputFilenameMIR = argv[2]; const char * outputFilename = argv[3]; - readerNIR->SetFileName( inputFilenameNIR ); - readerMIR->SetFileName( inputFilenameMIR ); - writer->SetFileName( outputFilename ); - filter->SetInput1( readerNIR->GetOutput() ); - filter->SetInput2( readerMIR->GetOutput() ); + readerNIR->SetFileName(inputFilenameNIR); + readerMIR->SetFileName(inputFilenameMIR); + writer->SetFileName(outputFilename); + filter->SetInput1(readerNIR->GetOutput()); + filter->SetInput2(readerMIR->GetOutput()); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilter.cxx index 7f4a191a42..0c5d734fff 100644 --- a/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilter.cxx @@ -23,16 +23,15 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - template<class TInputRImage, class TInputBImage, class TInputNIRImage, class TOutputImage, class TFunction> int generic_RAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputRImage> RReaderType; - typedef otb::ImageFileReader<TInputBImage> BReaderType; + typedef otb::ImageFileReader<TInputRImage> RReaderType; + typedef otb::ImageFileReader<TInputBImage> BReaderType; typedef otb::ImageFileReader<TInputNIRImage> NIRReaderType; - typedef otb::ImageFileWriter<TOutputImage> WriterType; + typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::RAndBAndNIRIndexImageFilter<TInputRImage,TInputBImage,TInputNIRImage,TOutputImage,TFunction> + typedef otb::RAndBAndNIRIndexImageFilter<TInputRImage, TInputBImage, TInputNIRImage, TOutputImage, TFunction> RAndBAndNIRIndexImageFilterType; // Instantiating object @@ -46,43 +45,42 @@ int generic_RAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) const char * inputFilenameB = argv[2]; const char * inputFilenameNIR = argv[3]; const char * outputFilename = argv[4]; - double gamma(::atof(argv[5])); - - readerR->SetFileName( inputFilenameR ); - readerB->SetFileName( inputFilenameB ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputB( readerB->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); + double gamma(::atof(argv[5])); + + readerR->SetFileName(inputFilenameR); + readerB->SetFileName(inputFilenameB); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputB(readerB->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); filter->GetFunctor().SetGamma(gamma); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - int otbRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputBImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputBImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "ARVI" ) return( generic_RAndBAndNIRVegetationIndexImageFilter<InputRImageType, InputBImageType, InputNIRImageType, OutputImageType, - otb::Functor::ARVI< InputRImageType::PixelType, - InputBImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else - return EXIT_FAILURE; + if (strArgv == "ARVI") + return (generic_RAndBAndNIRVegetationIndexImageFilter<InputRImageType, InputBImageType, InputNIRImageType, + OutputImageType, + otb::Functor::ARVI<InputRImageType::PixelType, + InputBImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilterNew.cxx b/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilterNew.cxx index 32216ff258..e437f39a5e 100644 --- a/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilterNew.cxx @@ -27,17 +27,17 @@ int otbRAndBAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputBImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputBImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; - typedef otb::RAndBAndNIRIndexImageFilter<InputRImageType,InputBImageType,InputNIRImageType,OutputImageType> RAndBAndNIRIndexImageFilterType; + typedef otb::RAndBAndNIRIndexImageFilter<InputRImageType, InputBImageType, InputNIRImageType, + OutputImageType> RAndBAndNIRIndexImageFilterType; // Instantiating object RAndBAndNIRIndexImageFilterType::Pointer object = RAndBAndNIRIndexImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbRAndGAndNIRVegetationIndexImageFilterNew.cxx b/Testing/Code/Radiometry/otbRAndGAndNIRVegetationIndexImageFilterNew.cxx index 1cd7d7f531..11f7e0cd72 100644 --- a/Testing/Code/Radiometry/otbRAndGAndNIRVegetationIndexImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbRAndGAndNIRVegetationIndexImageFilterNew.cxx @@ -27,17 +27,17 @@ int otbRAndGAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputGImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<PixelType,Dimension> OutputImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputGImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<PixelType, Dimension> OutputImageType; - typedef otb::RAndGAndNIRIndexImageFilter<InputRImageType,InputGImageType,InputNIRImageType,OutputImageType> RAndGAndNIRIndexImageFilterType; + typedef otb::RAndGAndNIRIndexImageFilter<InputRImageType, InputGImageType, InputNIRImageType, + OutputImageType> RAndGAndNIRIndexImageFilterType; // Instantiating object RAndGAndNIRIndexImageFilterType::Pointer object = RAndGAndNIRIndexImageFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilter.cxx index a9ea26633a..a20b940a82 100644 --- a/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilter.cxx @@ -26,11 +26,11 @@ template<class TInputRImage, class TInputNIRImage, class TOutputImage, class TFunction> int generic_RAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputRImage> RReaderType; + typedef otb::ImageFileReader<TInputRImage> RReaderType; typedef otb::ImageFileReader<TInputNIRImage> NIRReaderType; - typedef otb::ImageFileWriter<TOutputImage> WriterType; + typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::RAndNIRIndexImageFilter<TInputRImage,TInputNIRImage,TOutputImage,TFunction> + typedef otb::RAndNIRIndexImageFilter<TInputRImage, TInputNIRImage, TOutputImage, TFunction> RAndNIRIndexImageFilterType; // Instantiating object @@ -43,76 +43,82 @@ int generic_RAndNIRVegetationIndexImageFilter(int argc, char * argv[]) const char * inputFilenameNIR = argv[2]; const char * outputFilename = argv[3]; - readerR->SetFileName( inputFilenameR ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + readerR->SetFileName(inputFilenameR); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - int otbRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "NDVI" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::NDVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "RVI" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::RVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "SAVI" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::SAVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "TSAVI" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::TSAVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "MSAVI" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::MSAVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "MSAVI2" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::MSAVI2< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "GEMI" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::GEMI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "IPVI" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::IPVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else if ( strArgv == "TNDVI" ) return( generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::TNDVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv) ); - else - return EXIT_FAILURE; + if (strArgv == "NDVI") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::NDVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "RVI") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::RVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "SAVI") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::SAVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "TSAVI") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::TSAVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "MSAVI") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::MSAVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "MSAVI2") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::MSAVI2<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "GEMI") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::GEMI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "IPVI") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::IPVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else if (strArgv == "TNDVI") + return (generic_RAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::TNDVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv)); + else return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilterNew.cxx b/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilterNew.cxx index 411446ab1e..dd216fa441 100644 --- a/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilterNew.cxx @@ -28,12 +28,12 @@ int otbRAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef itk::Image<PixelType,Dimension> InputNIRImageType; - typedef itk::Image<PixelType,Dimension> OutputImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef itk::Image<PixelType, Dimension> InputNIRImageType; + typedef itk::Image<PixelType, Dimension> OutputImageType; - typedef otb::RAndNIRIndexImageFilter<InputRImageType,InputNIRImageType,OutputImageType> RAndNIRIndexImageFilterType; + typedef otb::RAndNIRIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType> RAndNIRIndexImageFilterType; // Instantiating object RAndNIRIndexImageFilterType::Pointer object = RAndNIRIndexImageFilterType::New(); diff --git a/Testing/Code/Radiometry/otbRadiometryTests1.cxx b/Testing/Code/Radiometry/otbRadiometryTests1.cxx index 701046149a..d02acd4aa5 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests1.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests1.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -30,4 +29,3 @@ void RegisterTests() REGISTER_TEST(otbMultiChannelRAndNIRVegetationIndexImageFilterNew); REGISTER_TEST(otbMultiChannelRAndNIRVegetationIndexImageFilter); } - diff --git a/Testing/Code/Radiometry/otbRadiometryTests2.cxx b/Testing/Code/Radiometry/otbRadiometryTests2.cxx index 0cd99bab82..88bb1e7a49 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests2.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests2.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -41,4 +40,3 @@ void RegisterTests() REGISTER_TEST(otbImageToReflectanceImageFilter); REGISTER_TEST(otbImageToReflectanceImageFilterAuto); } - diff --git a/Testing/Code/Radiometry/otbRadiometryTests3.cxx b/Testing/Code/Radiometry/otbRadiometryTests3.cxx index 30efa7ddbc..7842be27ea 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests3.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests3.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -40,4 +39,3 @@ void RegisterTests() REGISTER_TEST(otbSurfaceAdjencyEffect6SCorrectionSchemeFilter); REGISTER_TEST(otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter); } - diff --git a/Testing/Code/Radiometry/otbRadiometryTests4.cxx b/Testing/Code/Radiometry/otbRadiometryTests4.cxx index c3d782cc37..b92da06276 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests4.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests4.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -35,4 +34,3 @@ void RegisterTests() REGISTER_TEST(otbTSARVIRAndBAndNIRVegetationIndexImageFilter); REGISTER_TEST(otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter); } - diff --git a/Testing/Code/Radiometry/otbRadiometryTests5.cxx b/Testing/Code/Radiometry/otbRadiometryTests5.cxx index 6407d51436..b6dfb9c8bc 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests5.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests5.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -31,4 +30,3 @@ void RegisterTests() REGISTER_TEST(otbRAndNIRVegetationIndexImageFilterNew); REGISTER_TEST(otbRAndNIRVegetationIndexImageFilter); } - diff --git a/Testing/Code/Radiometry/otbRadiometryTests6.cxx b/Testing/Code/Radiometry/otbRadiometryTests6.cxx index 9738f59325..9d3469dca9 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests6.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests6.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -36,4 +35,3 @@ void RegisterTests() REGISTER_TEST(otbWDVIRAndNIRVegetationIndexImageFilter); REGISTER_TEST(otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter); } - diff --git a/Testing/Code/Radiometry/otbRadiometryTests7.cxx b/Testing/Code/Radiometry/otbRadiometryTests7.cxx index 189e69788d..03c9df39b4 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests7.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests7.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -34,4 +33,3 @@ void RegisterTests() REGISTER_TEST(otbIBGAndRAndNIRIndexImageFilter); REGISTER_TEST(otbIBMultiChannelGAndRAndNIRIndexImageFilter); } - diff --git a/Testing/Code/Radiometry/otbRadiometryTests8.cxx b/Testing/Code/Radiometry/otbRadiometryTests8.cxx index 311e20d875..e0494059f8 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests8.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests8.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -38,5 +37,3 @@ void RegisterTests() REGISTER_TEST(otbAeronetExtractData); REGISTER_TEST(otbAeronetExtractDataBadData); } - - diff --git a/Testing/Code/Radiometry/otbRadiometryTests9.cxx b/Testing/Code/Radiometry/otbRadiometryTests9.cxx index 2d15f95efb..0c9a55d3c1 100644 --- a/Testing/Code/Radiometry/otbRadiometryTests9.cxx +++ b/Testing/Code/Radiometry/otbRadiometryTests9.cxx @@ -22,19 +22,16 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() { -REGISTER_TEST(otbTerraSarBrightnessFunctor); -REGISTER_TEST(otbTerraSarCalibrationFunctor); -REGISTER_TEST(otbTerraSarCalibrationImageFilterNew); -REGISTER_TEST(otbTerraSarCalibrationImageFilterTest); -REGISTER_TEST(otbTerraSarCalibrationImageComplexFilterTest); -REGISTER_TEST(otbTerraSarBrightnessImageFilterNew); -REGISTER_TEST(otbTerraSarBrightnessImageFilterTest); -REGISTER_TEST(otbTerraSarBrightnessImageComplexFilterTest); + REGISTER_TEST(otbTerraSarBrightnessFunctor); + REGISTER_TEST(otbTerraSarCalibrationFunctor); + REGISTER_TEST(otbTerraSarCalibrationImageFilterNew); + REGISTER_TEST(otbTerraSarCalibrationImageFilterTest); + REGISTER_TEST(otbTerraSarCalibrationImageComplexFilterTest); + REGISTER_TEST(otbTerraSarBrightnessImageFilterNew); + REGISTER_TEST(otbTerraSarBrightnessImageFilterTest); + REGISTER_TEST(otbTerraSarBrightnessImageComplexFilterTest); } - - diff --git a/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.cxx b/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.cxx index 47b5af37c0..9e0526fdb2 100644 --- a/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.cxx +++ b/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.cxx @@ -29,16 +29,17 @@ int otbReflectanceToSurfaceReflectanceImageFilter(int argc, char * argv[]) const char * outputFileName = argv[2]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ReflectanceToSurfaceReflectanceImageFilter<InputImageType, OutputImageType> ReflectanceToSurfaceReflectanceImageFilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ReflectanceToSurfaceReflectanceImageFilter<InputImageType, + OutputImageType> + ReflectanceToSurfaceReflectanceImageFilterType; typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; otb::AtmosphericRadiativeTerms::Pointer atmo = otb::AtmosphericRadiativeTerms::New(); - ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); reader->SetFileName(inputFileName); @@ -53,14 +54,14 @@ int otbReflectanceToSurfaceReflectanceImageFilter(int argc, char * argv[]) DataVectorType downTrans; DataVectorType upTrans; - for ( unsigned int j=0; j<nbChannel; j++) - { - intrinsic.push_back(static_cast<double>(atof(argv[3+j]))); - albedo.push_back(static_cast<double>(atof(argv[3+j+nbChannel]))); - gaseous.push_back(static_cast<double>(atof(argv[3+j+2*nbChannel]))); - downTrans.push_back(static_cast<double>(atof(argv[3+j+3*nbChannel]))); - upTrans.push_back(static_cast<double>(atof(argv[3+j+4*nbChannel]))); - } + for (unsigned int j = 0; j < nbChannel; j++) + { + intrinsic.push_back(static_cast<double>(atof(argv[3 + j]))); + albedo.push_back(static_cast<double>(atof(argv[3 + j + nbChannel]))); + gaseous.push_back(static_cast<double>(atof(argv[3 + j + 2 * nbChannel]))); + downTrans.push_back(static_cast<double>(atof(argv[3 + j + 3 * nbChannel]))); + upTrans.push_back(static_cast<double>(atof(argv[3 + j + 4 * nbChannel]))); + } atmo->SetIntrinsicAtmosphericReflectances(intrinsic); atmo->SetSphericalAlbedos(albedo); @@ -76,6 +77,5 @@ int otbReflectanceToSurfaceReflectanceImageFilter(int argc, char * argv[]) writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilterNew.cxx b/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilterNew.cxx index e9c3a64ca7..1e12f48213 100644 --- a/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilterNew.cxx @@ -20,14 +20,15 @@ #include "otbReflectanceToSurfaceReflectanceImageFilter.h" #include "otbVectorImage.h" - int otbReflectanceToSurfaceReflectanceImageFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; - typedef otb::ReflectanceToSurfaceReflectanceImageFilter<InputImageType,InputImageType> ReflectanceToSurfaceReflectanceImageFilterType; + typedef otb::ReflectanceToSurfaceReflectanceImageFilter<InputImageType, + InputImageType> + ReflectanceToSurfaceReflectanceImageFilterType; // Instantiating object ReflectanceToSurfaceReflectanceImageFilterType::Pointer filter = ReflectanceToSurfaceReflectanceImageFilterType::New(); diff --git a/Testing/Code/Radiometry/otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx b/Testing/Code/Radiometry/otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx index e0ebf526ed..29de9896f1 100644 --- a/Testing/Code/Radiometry/otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx +++ b/Testing/Code/Radiometry/otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx @@ -24,33 +24,35 @@ #include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" #include "otbAtmosphericCorrectionParameters.h" #include "otbAtmosphericRadiativeTerms.h" -#include<fstream> -#include<iostream> - +#include <fstream> +#include <iostream> int otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter(int argc, char * argv[]) { - const char * inputFileName = argv[1]; - const char * outputFileName = argv[2]; - const char * paramFile = argv[3]; + const char * inputFileName = argv[1]; + const char * outputFileName = argv[2]; + const char * paramFile = argv[3]; std::vector<const char *> wavelenghFiles; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - typedef otb::ReflectanceToSurfaceReflectanceImageFilter<InputImageType, OutputImageType> ReflectanceToSurfaceReflectanceImageFilterType; - typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms CorrectionParametersTo6SRadiativeTermsType; - typedef otb::AtmosphericCorrectionParameters CorrectionParametersType; - typedef otb::AtmosphericRadiativeTerms RadiativeTermsType; - typedef otb::FilterFunctionValues FilterFunctionValuesType; - typedef CorrectionParametersType::AerosolModelType AerosolModelType; - typedef FilterFunctionValuesType::WavelenghtSpectralBandType ValueType; - typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + + typedef otb::ReflectanceToSurfaceReflectanceImageFilter<InputImageType, + OutputImageType> + ReflectanceToSurfaceReflectanceImageFilterType; + typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; + typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms + CorrectionParametersTo6SRadiativeTermsType; + typedef otb::AtmosphericCorrectionParameters CorrectionParametersType; + typedef otb::AtmosphericRadiativeTerms RadiativeTermsType; + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef CorrectionParametersType::AerosolModelType AerosolModelType; + typedef FilterFunctionValuesType::WavelenghtSpectralBandType ValueType; + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; RadiativeTermsType::Pointer radiative = RadiativeTermsType::New(); CorrectionParametersType::Pointer param = CorrectionParametersType::New(); @@ -64,41 +66,41 @@ int otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter(int argc, char * reader->UpdateOutputInformation(); unsigned int nbChannel = reader->GetOutput()->GetNumberOfComponentsPerPixel(); - for (unsigned int i=0; i<nbChannel; i++) - { - wavelenghFiles.push_back( argv[i+4] ); - } + for (unsigned int i = 0; i < nbChannel; i++) + { + wavelenghFiles.push_back(argv[i + 4]); + } ValueType val = 0.0025; // Correction parameters initialization - double solarZenithalAngle(0.); - double solarAzimutalAngle(0.); - double viewingZenithalAngle(0.); - double viewingAzimutalAngle(0.); + double solarZenithalAngle(0.); + double solarAzimutalAngle(0.); + double viewingZenithalAngle(0.); + double viewingAzimutalAngle(0.); unsigned int month(0); unsigned int day(0); - double atmosphericPressure(0.); - double waterVaporAmount(0.); - double ozoneAmount(0.); - double aerosolOptical(0.); + double atmosphericPressure(0.); + double waterVaporAmount(0.); + double ozoneAmount(0.); + double aerosolOptical(0.); std::ifstream fin; fin.open(paramFile); //Read input file parameters - fin >> solarZenithalAngle;//asol; - fin >> solarAzimutalAngle;//phi0; - fin >> viewingZenithalAngle;//avis; - fin >> viewingAzimutalAngle;//phiv; - fin >> month;//month; - fin >> day;//jday; - fin >> atmosphericPressure;//pressure; - fin >> waterVaporAmount;//uw; - fin >> ozoneAmount;//uo3; + fin >> solarZenithalAngle; //asol; + fin >> solarAzimutalAngle; //phi0; + fin >> viewingZenithalAngle; //avis; + fin >> viewingAzimutalAngle; //phiv; + fin >> month; //month; + fin >> day; //jday; + fin >> atmosphericPressure; //pressure; + fin >> waterVaporAmount; //uw; + fin >> ozoneAmount; //uo3; unsigned int aer(0); - fin >> aer;//iaer; + fin >> aer; //iaer; AerosolModelType aerosolModel = static_cast<AerosolModelType>(aer); - fin >> aerosolOptical;//taer55; + fin >> aerosolOptical; //taer55; fin.close(); // Set atmospheric parameters param->SetSolarZenithalAngle(static_cast<double>(solarZenithalAngle)); @@ -113,10 +115,9 @@ int otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter(int argc, char * param->SetAerosolModel(aerosolModel); param->SetAerosolOptical(static_cast<double>(aerosolOptical)); - ValuesVectorType vect; - for (unsigned int j=0; j<nbChannel; j++) - { + for (unsigned int j = 0; j < nbChannel; j++) + { functionValues = FilterFunctionValuesType::New(); vect.clear(); @@ -128,34 +129,33 @@ int otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter(int argc, char * std::ifstream fin; //Read input file parameters fin.open(wavelenghFiles[j]); - fin >> minSpectralValue;//wlinf; - fin >> maxSpectralValue;//wlsup; + fin >> minSpectralValue; //wlinf; + fin >> maxSpectralValue; //wlsup; while (fin.good()) - { + { fin >> value; vect.push_back(value); - } + } fin.close(); functionValues->SetFilterFunctionValues(vect); functionValues->SetMinSpectralValue(minSpectralValue); functionValues->SetMaxSpectralValue(maxSpectralValue); - functionValues->SetUserStep( val ); + functionValues->SetUserStep(val); param->SetWavelenghtSpectralBandWithIndex(j, functionValues); - } + } - corrToRadia->SetInput( param ); + corrToRadia->SetInput(param); corrToRadia->Update(); // Instantiating object ReflectanceToSurfaceReflectanceImageFilterType::Pointer filter = ReflectanceToSurfaceReflectanceImageFilterType::New(); - filter->SetAtmosphericRadiativeTerms( corrToRadia->GetOutput() ); + filter->SetAtmosphericRadiativeTerms(corrToRadia->GetOutput()); filter->SetInput(reader->GetOutput()); writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx b/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx index e700be5758..2eb88b7f36 100644 --- a/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx +++ b/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx @@ -34,65 +34,64 @@ int otbSIXSTraitsComputeAtmosphericParametersTest(int argc, char * argv[]) typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; // Instantiating object typedef otb::FilterFunctionValues FilterFunctionValuesType; - FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New(); + FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New(); FilterFunctionValuesType::ValuesVectorType vect; - - double SolarZenithalAngle(0.); - double SolarAzimutalAngle(0.); - double ViewingZenithalAngle(0.); - double ViewingAzimutalAngle(0.); + double SolarZenithalAngle(0.); + double SolarAzimutalAngle(0.); + double ViewingZenithalAngle(0.); + double ViewingAzimutalAngle(0.); unsigned int Month(0); unsigned int Day(0); - double AtmosphericPressure(0.); - double WaterVaporAmount(0.); - double OzoneAmount(0.); + double AtmosphericPressure(0.); + double WaterVaporAmount(0.); + double OzoneAmount(0.); typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; AerosolModelType AerosolModel; - double AerosolOptical(0.); - double AtmosphericReflectance(0.); - double AtmosphericSphericalAlbedo(0.); - double TotalGaseousTransmission(0.); - double DownwardTransmittance(0.); - double UpwardTransmittance(0.); - double UpwardDiffuseTransmittance(0.); - double UpwardDirectTransmittance(0.); - double UpwardDiffuseTransmittanceForRayleigh(0.); - double UpwardDiffuseTransmittanceForAerosol(0.); + double AerosolOptical(0.); + double AtmosphericReflectance(0.); + double AtmosphericSphericalAlbedo(0.); + double TotalGaseousTransmission(0.); + double DownwardTransmittance(0.); + double UpwardTransmittance(0.); + double UpwardDiffuseTransmittance(0.); + double UpwardDirectTransmittance(0.); + double UpwardDiffuseTransmittanceForRayleigh(0.); + double UpwardDiffuseTransmittanceForAerosol(0.); std::ifstream fin; std::ofstream fout; //Read input file parameters fin.open(inname); - fin >> SolarZenithalAngle;//asol; - fin >> SolarAzimutalAngle;//phi0; - fin >> ViewingZenithalAngle;//avis; - fin >> ViewingAzimutalAngle;//phiv; - fin >> Month;//month; - fin >> Day;//jday; - - fin >> AtmosphericPressure;//pressure; - fin >> WaterVaporAmount;//uw; - fin >> OzoneAmount;//uo3; + fin >> SolarZenithalAngle; //asol; + fin >> SolarAzimutalAngle; //phi0; + fin >> ViewingZenithalAngle; //avis; + fin >> ViewingAzimutalAngle; //phiv; + fin >> Month; //month; + fin >> Day; //jday; + + fin >> AtmosphericPressure; //pressure; + fin >> WaterVaporAmount; //uw; + fin >> OzoneAmount; //uo3; unsigned int aer(0); - fin >> aer;//iaer; + fin >> aer; //iaer; AerosolModel = static_cast<AerosolModelType>(aer); - fin >> AerosolOptical;//taer55; + fin >> AerosolOptical; //taer55; float MinSpectralValue(0.); float MaxSpectralValue(0.); float value(0.); - fin >> MinSpectralValue;//wlinf; - fin >> MaxSpectralValue;//wlsup; + fin >> MinSpectralValue; //wlinf; + fin >> MaxSpectralValue; //wlsup; while (!fin.eof() && fin.good()) - { + { fin >> value; vect.push_back(value); - } + } fin.close(); functionValues->SetFilterFunctionValues(vect); @@ -121,51 +120,56 @@ int otbSIXSTraitsComputeAtmosphericParametersTest(int argc, char * argv[]) UpwardDiffuseTransmittance, UpwardDirectTransmittance, UpwardDiffuseTransmittanceForRayleigh, - UpwardDiffuseTransmittanceForAerosol ); + UpwardDiffuseTransmittanceForAerosol); fout.open(outname); - fout <<" ---------------------------------------------------------"<<std::endl; - fout << "Inputs values:"<<std::setprecision(10)<<std::endl; - fout << " -----> SolarZenithalAngle : "<<SolarZenithalAngle<<std::endl; - fout << " -----> SolarAzimutalAngle : "<<SolarAzimutalAngle<<std::endl; - fout << " -----> ViewingZenithalAngle : "<<ViewingZenithalAngle<<std::endl; - fout << " -----> ViewingAzimutalAngle : "<<ViewingAzimutalAngle<<std::endl; - fout << " -----> Month : "<<Month<<std::endl; - fout << " -----> Day : "<<Day<<std::endl; - fout << " -----> AtmosphericPressure : "<<AtmosphericPressure<<std::endl; - fout << " -----> WaterVaporAmount : "<<WaterVaporAmount<<std::endl; - fout << " -----> OzoneAmount : "<<OzoneAmount<<std::endl; - fout << " -----> AerosolModel : "<<aer<<std::endl; - fout << " -----> AerosolOptical : "<<AerosolOptical<<std::endl; - fout << " -----> MinSpectralValue : "<<MinSpectralValue<<std::endl; - fout << " -----> MaxSpectralValue : "<<MaxSpectralValue<<std::endl; - fout << " -----> UserStep : "<<functionValues->GetUserStep()<<std::endl; - fout <<" ---------------------------------------------------------"<<std::endl; - fout << "Outputs values:"<<std::endl; - fout << " -----> atmospheric reflectance : "<<AtmosphericReflectance<<std::endl; - fout << " -----> atmospheric spherical albedo : "<<AtmosphericSphericalAlbedo<<std::endl; - fout << " -----> total gaseous transmission : "<<TotalGaseousTransmission<<std::endl; - fout << " -----> downward transmittance : "<<DownwardTransmittance<<std::endl; - fout << " -----> upward transmittance : "<<UpwardTransmittance<<std::endl; - fout << " -----> upward diffuse transmittance : "<<UpwardDiffuseTransmittance<<std::endl; - fout << " -----> upward direct transmittance : "<<UpwardDirectTransmittance<<std::endl; - fout << " -----> upward diffuse transmittance for rayleigh : "<<UpwardDiffuseTransmittanceForRayleigh<<std::endl; - fout << " -----> upward diffuse transmittance for aerosols : "<<UpwardDiffuseTransmittanceForAerosol<<std::endl; - fout << " -----> MinSpectralValue update: "<<functionValues->GetMinSpectralValue()<<std::endl; - fout << " -----> MaxSpectralValue update : "<<functionValues->GetMaxSpectralValue()<<std::endl; - fout <<" ---------------------------------------------------------"<<std::endl; - fout<<"Input wavelenght band values ["<<functionValues->GetFilterFunctionValues().size()<<"]:"<<std::endl; - for (unsigned int i=0; i<functionValues->GetFilterFunctionValues().size(); i++) - { - fout<< " "<<functionValues->GetFilterFunctionValues()[i] <<std::endl; - } - fout <<" ---------------------------------------------------------"<<std::endl; - fout<<"Output wavelenght band values 6S ["<<functionValues->GetFilterFunctionValues6S().size()<<"]:"<<std::endl; - for (unsigned int i=0; i<functionValues->GetFilterFunctionValues6S().size(); i++) - { - fout<< " "<<functionValues->GetFilterFunctionValues6S()[i] <<std::endl; - } - fout<<std::endl; + fout << " ---------------------------------------------------------" << std::endl; + fout << "Inputs values:" << std::setprecision(10) << std::endl; + fout << " -----> SolarZenithalAngle : " << SolarZenithalAngle << std::endl; + fout << " -----> SolarAzimutalAngle : " << SolarAzimutalAngle << std::endl; + fout << " -----> ViewingZenithalAngle : " << ViewingZenithalAngle << std::endl; + fout << " -----> ViewingAzimutalAngle : " << ViewingAzimutalAngle << std::endl; + fout << " -----> Month : " << Month << std::endl; + fout << " -----> Day : " << Day << std::endl; + fout << " -----> AtmosphericPressure : " << AtmosphericPressure << std::endl; + fout << " -----> WaterVaporAmount : " << WaterVaporAmount << std::endl; + fout << " -----> OzoneAmount : " << OzoneAmount << std::endl; + fout << " -----> AerosolModel : " << aer << std::endl; + fout << " -----> AerosolOptical : " << AerosolOptical << std::endl; + fout << " -----> MinSpectralValue : " << MinSpectralValue << std::endl; + fout << " -----> MaxSpectralValue : " << MaxSpectralValue << std::endl; + fout << " -----> UserStep : " << functionValues->GetUserStep() << std::endl; + fout << " ---------------------------------------------------------" << std::endl; + fout << "Outputs values:" << std::endl; + fout << " -----> atmospheric reflectance : " << AtmosphericReflectance << std::endl; + fout << " -----> atmospheric spherical albedo : " << AtmosphericSphericalAlbedo << std::endl; + fout << " -----> total gaseous transmission : " << TotalGaseousTransmission << std::endl; + fout << " -----> downward transmittance : " << DownwardTransmittance << std::endl; + fout << " -----> upward transmittance : " << UpwardTransmittance << std::endl; + fout << " -----> upward diffuse transmittance : " << UpwardDiffuseTransmittance << std::endl; + fout << " -----> upward direct transmittance : " << UpwardDirectTransmittance << std::endl; + fout << " -----> upward diffuse transmittance for rayleigh : " << UpwardDiffuseTransmittanceForRayleigh << + std::endl; + fout << " -----> upward diffuse transmittance for aerosols : " << UpwardDiffuseTransmittanceForAerosol << + std::endl; + fout << " -----> MinSpectralValue update: " << functionValues->GetMinSpectralValue() << + std::endl; + fout << " -----> MaxSpectralValue update : " << functionValues->GetMaxSpectralValue() << + std::endl; + fout << " ---------------------------------------------------------" << std::endl; + fout << "Input wavelenght band values [" << functionValues->GetFilterFunctionValues().size() << "]:" << std::endl; + for (unsigned int i = 0; i < functionValues->GetFilterFunctionValues().size(); i++) + { + fout << " " << functionValues->GetFilterFunctionValues()[i] << std::endl; + } + fout << " ---------------------------------------------------------" << std::endl; + fout << "Output wavelenght band values 6S [" << functionValues->GetFilterFunctionValues6S().size() << "]:" << + std::endl; + for (unsigned int i = 0; i < functionValues->GetFilterFunctionValues6S().size(); i++) + { + fout << " " << functionValues->GetFilterFunctionValues6S()[i] << std::endl; + } + fout << std::endl; fout.close(); return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter.cxx index bc50e6de99..88b9100099 100644 --- a/Testing/Code/Radiometry/otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter.cxx @@ -27,49 +27,49 @@ template<class TInputImage, class TOutputImage, class TFunction> void generic_SetASetBMultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputImage> ReaderType; + typedef otb::ImageFileReader<TInputImage> ReaderType; typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::MultiChannelRAndNIRIndexImageFilter<TInputImage,TOutputImage,TFunction> + typedef otb::MultiChannelRAndNIRIndexImageFilter<TInputImage, TOutputImage, TFunction> MultiChannelRAndNIRIndexImageFilterType; // Instantiating object typename MultiChannelRAndNIRIndexImageFilterType::Pointer filter = MultiChannelRAndNIRIndexImageFilterType::New(); typename ReaderType::Pointer reader = ReaderType::New(); typename WriterType::Pointer writer = WriterType::New(); - double a(::atof(argv[1])); - double b(::atof(argv[2])); + double a(::atof(argv[1])); + double b(::atof(argv[2])); const char * inputFilename = argv[3]; const char * outputFilename = argv[4]; unsigned int redChannel(::atoi(argv[5])); unsigned int nirChannel(::atoi(argv[6])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - filter->SetInput( reader->GetOutput() ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); + filter->SetInput(reader->GetOutput()); filter->SetRedIndex(redChannel); filter->SetNIRIndex(nirChannel); filter->GetFunctor().SetA(a); filter->GetFunctor().SetB(b); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); } - int otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef otb::VectorImage<unsigned char, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "PVI" ) generic_SetASetBMultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, - otb::Functor::PVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType> > - (argc,argv); + if (strArgv == "PVI") + generic_SetASetBMultiChannelRAndNIRVegetationIndexImageFilter<InputImageType, OutputImageType, + otb::Functor::PVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> > + (argc, argv); return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbSetASetBRAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbSetASetBRAndNIRVegetationIndexImageFilter.cxx index 5c1e58e24e..f368c68b65 100644 --- a/Testing/Code/Radiometry/otbSetASetBRAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbSetASetBRAndNIRVegetationIndexImageFilter.cxx @@ -26,11 +26,11 @@ template<class TInputRImage, class TInputNIRImage, class TOutputImage, class TFunction> void generic_SetASetBRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - typedef otb::ImageFileReader<TInputRImage> RReaderType; + typedef otb::ImageFileReader<TInputRImage> RReaderType; typedef otb::ImageFileReader<TInputNIRImage> NIRReaderType; - typedef otb::ImageFileWriter<TOutputImage> WriterType; + typedef otb::ImageFileWriter<TOutputImage> WriterType; - typedef otb::RAndNIRIndexImageFilter<TInputRImage,TInputNIRImage,TOutputImage,TFunction> + typedef otb::RAndNIRIndexImageFilter<TInputRImage, TInputNIRImage, TOutputImage, TFunction> RAndNIRIndexImageFilterType; // Instantiating object @@ -38,39 +38,39 @@ void generic_SetASetBRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) typename RReaderType::Pointer readerR = RReaderType::New(); typename NIRReaderType::Pointer readerNIR = NIRReaderType::New(); typename WriterType::Pointer writer = WriterType::New(); - double a(::atof(argv[1])); - double b(::atof(argv[2])); + double a(::atof(argv[1])); + double b(::atof(argv[2])); const char * inputFilenameR = argv[3]; const char * inputFilenameNIR = argv[4]; const char * outputFilename = argv[5]; - readerR->SetFileName( inputFilenameR ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); + readerR->SetFileName(inputFilenameR); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); filter->GetFunctor().SetA(a); filter->GetFunctor().SetB(b); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); } - int otbSetASetBRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; std::string strArgv(argv[1]); argc--; argv++; - if ( strArgv == "PVI" ) generic_SetASetBRAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, - otb::Functor::PVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType> > - (argc,argv); + if (strArgv == "PVI") + generic_SetASetBRAndNIRVegetationIndexImageFilter<InputRImageType, InputNIRImageType, OutputImageType, + otb::Functor::PVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> > + (argc, argv); return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbSurfaceAdjencyEffect6SCorrectionSchemeFilter.cxx b/Testing/Code/Radiometry/otbSurfaceAdjencyEffect6SCorrectionSchemeFilter.cxx index b060fa704e..b2123fb13c 100644 --- a/Testing/Code/Radiometry/otbSurfaceAdjencyEffect6SCorrectionSchemeFilter.cxx +++ b/Testing/Code/Radiometry/otbSurfaceAdjencyEffect6SCorrectionSchemeFilter.cxx @@ -25,8 +25,8 @@ #include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" #include "otbAtmosphericCorrectionParameters.h" #include "otbAtmosphericRadiativeTerms.h" -#include<fstream> -#include<iostream> +#include <fstream> +#include <iostream> int otbSurfaceAdjencyEffect6SCorrectionSchemeFilter(int argc, char * argv[]) { @@ -35,32 +35,35 @@ int otbSurfaceAdjencyEffect6SCorrectionSchemeFilter(int argc, char * argv[]) const char * paramFile = argv[5]; const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::VectorImage<PixelType,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - typedef otb::SurfaceAdjencyEffect6SCorrectionSchemeFilter<InputImageType, OutputImageType> SurfaceAdjencyEffect6SCorrectionSchemeFilterType; - typedef SurfaceAdjencyEffect6SCorrectionSchemeFilterType::WeightingMatrixType WeightingMatrixType; - typedef SurfaceAdjencyEffect6SCorrectionSchemeFilterType::WeightingValuesContainerType WeightingValuesContainerType; - - typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms CorrectionParametersTo6SRadiativeTermsType; - typedef otb::AtmosphericCorrectionParameters CorrectionParametersType; - typedef otb::AtmosphericRadiativeTerms RadiativeTermsType; - typedef otb::FilterFunctionValues FilterFunctionValuesType; - typedef CorrectionParametersType::AerosolModelType AerosolModelType; - typedef FilterFunctionValuesType::WavelenghtSpectralBandType ValueType; - typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; - + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::VectorImage<PixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + + typedef otb::SurfaceAdjencyEffect6SCorrectionSchemeFilter<InputImageType, + OutputImageType> + SurfaceAdjencyEffect6SCorrectionSchemeFilterType; + typedef SurfaceAdjencyEffect6SCorrectionSchemeFilterType::WeightingMatrixType WeightingMatrixType; + typedef SurfaceAdjencyEffect6SCorrectionSchemeFilterType::WeightingValuesContainerType + WeightingValuesContainerType; + + typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; + typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms CorrectionParametersTo6SRadiativeTermsType; + typedef otb::AtmosphericCorrectionParameters CorrectionParametersType; + typedef otb::AtmosphericRadiativeTerms RadiativeTermsType; + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef CorrectionParametersType::AerosolModelType AerosolModelType; + typedef FilterFunctionValuesType::WavelenghtSpectralBandType ValueType; + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; RadiativeTermsType::Pointer radiative = RadiativeTermsType::New(); CorrectionParametersType::Pointer param = CorrectionParametersType::New(); CorrectionParametersTo6SRadiativeTermsType::Pointer corrToRadia = CorrectionParametersTo6SRadiativeTermsType::New(); FilterFunctionValuesType::Pointer functionValues; // Instantiating object - SurfaceAdjencyEffect6SCorrectionSchemeFilterType::Pointer filter = SurfaceAdjencyEffect6SCorrectionSchemeFilterType::New(); + SurfaceAdjencyEffect6SCorrectionSchemeFilterType::Pointer filter = + SurfaceAdjencyEffect6SCorrectionSchemeFilterType::New(); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -68,43 +71,42 @@ int otbSurfaceAdjencyEffect6SCorrectionSchemeFilter(int argc, char * argv[]) writer->SetFileName(outputFileName); reader->UpdateOutputInformation(); std::vector<const char *> wavelenghFiles; - unsigned int nbChannel = reader->GetOutput()->GetNumberOfComponentsPerPixel(); - for (unsigned int i=0; i<nbChannel; i++) - { - wavelenghFiles.push_back( argv[i+6] ); - } + unsigned int nbChannel = reader->GetOutput()->GetNumberOfComponentsPerPixel(); + for (unsigned int i = 0; i < nbChannel; i++) + { + wavelenghFiles.push_back(argv[i + 6]); + } ValueType val = 0.0025; // Correction parameters initialization - double solarZenithalAngle(0.); - double solarAzimutalAngle(0.); - double viewingZenithalAngle(0.); - double viewingAzimutalAngle(0.); + double solarZenithalAngle(0.); + double solarAzimutalAngle(0.); + double viewingZenithalAngle(0.); + double viewingAzimutalAngle(0.); unsigned int month(0); unsigned int day(0); - double atmosphericPressure(0.); - double waterVaporAmount(0.); - double ozoneAmount(0.); - double aerosolOptical(0.); - + double atmosphericPressure(0.); + double waterVaporAmount(0.); + double ozoneAmount(0.); + double aerosolOptical(0.); std::ifstream fin; fin.open(paramFile); //Read input file parameters - fin >> solarZenithalAngle;//asol; - fin >> solarAzimutalAngle;//phi0; - fin >> viewingZenithalAngle;//avis; - fin >> viewingAzimutalAngle;//phiv; - fin >> month;//month; - fin >> day;//jday; - fin >> atmosphericPressure;//pressure; - fin >> waterVaporAmount;//uw; - fin >> ozoneAmount;//uo3; + fin >> solarZenithalAngle; //asol; + fin >> solarAzimutalAngle; //phi0; + fin >> viewingZenithalAngle; //avis; + fin >> viewingAzimutalAngle; //phiv; + fin >> month; //month; + fin >> day; //jday; + fin >> atmosphericPressure; //pressure; + fin >> waterVaporAmount; //uw; + fin >> ozoneAmount; //uo3; unsigned int aer(0); - fin >> aer;//iaer; + fin >> aer; //iaer; AerosolModelType aerosolModel = static_cast<AerosolModelType>(aer); - fin >> aerosolOptical;//taer55; + fin >> aerosolOptical; //taer55; fin.close(); // Set atmospheric parameters param->SetSolarZenithalAngle(static_cast<double>(solarZenithalAngle)); @@ -120,8 +122,8 @@ int otbSurfaceAdjencyEffect6SCorrectionSchemeFilter(int argc, char * argv[]) param->SetAerosolOptical(static_cast<double>(aerosolOptical)); ValuesVectorType vect; - for (unsigned int j=0; j<nbChannel; j++) - { + for (unsigned int j = 0; j < nbChannel; j++) + { functionValues = FilterFunctionValuesType::New(); vect.clear(); @@ -133,25 +135,25 @@ int otbSurfaceAdjencyEffect6SCorrectionSchemeFilter(int argc, char * argv[]) std::ifstream fin; //Read input file parameters fin.open(wavelenghFiles[j]); - fin >> minSpectralValue;//wlinf; - fin >> maxSpectralValue;//wlsup; + fin >> minSpectralValue; //wlinf; + fin >> maxSpectralValue; //wlsup; while (!fin.eof() && fin.good()) - { + { fin >> value; vect.push_back(value); - } + } fin.close(); functionValues->SetFilterFunctionValues(vect); functionValues->SetMinSpectralValue(minSpectralValue); functionValues->SetMaxSpectralValue(maxSpectralValue); - functionValues->SetUserStep( val ); + functionValues->SetUserStep(val); param->SetWavelenghtSpectralBandWithIndex(j, functionValues); - } + } - corrToRadia->SetInput( param ); + corrToRadia->SetInput(param); corrToRadia->Update(); filter->SetAtmosphericRadiativeTerms(corrToRadia->GetOutput()); diff --git a/Testing/Code/Radiometry/otbSurfaceAdjencyEffect6SCorrectionSchemeFilterNew.cxx b/Testing/Code/Radiometry/otbSurfaceAdjencyEffect6SCorrectionSchemeFilterNew.cxx index ae9513e035..56b2ac04f8 100644 --- a/Testing/Code/Radiometry/otbSurfaceAdjencyEffect6SCorrectionSchemeFilterNew.cxx +++ b/Testing/Code/Radiometry/otbSurfaceAdjencyEffect6SCorrectionSchemeFilterNew.cxx @@ -21,16 +21,18 @@ #include "otbVectorImage.h" #include "otbImage.h" - int otbSurfaceAdjencyEffect6SCorrectionSchemeFilterNew(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType,Dimension> InputImageType; - typedef otb::SurfaceAdjencyEffect6SCorrectionSchemeFilter<InputImageType,InputImageType> SurfaceAdjencyEffect6SCorrectionSchemeFilterType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, Dimension> InputImageType; + typedef otb::SurfaceAdjencyEffect6SCorrectionSchemeFilter<InputImageType, + InputImageType> + SurfaceAdjencyEffect6SCorrectionSchemeFilterType; // Instantiating object - SurfaceAdjencyEffect6SCorrectionSchemeFilterType::Pointer filter = SurfaceAdjencyEffect6SCorrectionSchemeFilterType::New(); + SurfaceAdjencyEffect6SCorrectionSchemeFilterType::Pointer filter = + SurfaceAdjencyEffect6SCorrectionSchemeFilterType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx index 51d8de7905..db0d857ef3 100644 --- a/Testing/Code/Radiometry/otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx @@ -24,25 +24,24 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - int otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::TSARVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType > FunctorType; - typedef otb::MultiChannelRAndBAndNIRIndexImageFilter<InputImageType,OutputImageType,FunctorType> - MultiChannelRAndBAndNIRIndexImageFilterType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Functor::TSARVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> FunctorType; + typedef otb::MultiChannelRAndBAndNIRIndexImageFilter<InputImageType, OutputImageType, FunctorType> + MultiChannelRAndBAndNIRIndexImageFilterType; // Instantiating object MultiChannelRAndBAndNIRIndexImageFilterType::Pointer filter = MultiChannelRAndBAndNIRIndexImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -51,27 +50,25 @@ int otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * unsigned int blueChannel(::atoi(argv[4])); unsigned int nirChannel(::atoi(argv[5])); - double a(::atof(argv[6])); - double b(::atof(argv[7])); - double x(::atof(argv[8])); - double gamma(::atof(argv[9])); + double a(::atof(argv[6])); + double b(::atof(argv[7])); + double x(::atof(argv[8])); + double gamma(::atof(argv[9])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetRedIndex(redChannel); filter->SetBlueIndex(blueChannel); filter->SetNIRIndex(nirChannel); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); filter->GetFunctor().SetA(a); filter->GetFunctor().SetB(b); filter->GetFunctor().SetX(x); filter->GetFunctor().SetGamma(gamma); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Radiometry/otbTSARVIRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbTSARVIRAndBAndNIRVegetationIndexImageFilter.cxx index fd92305920..4e1b354eca 100644 --- a/Testing/Code/Radiometry/otbTSARVIRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbTSARVIRAndBAndNIRVegetationIndexImageFilter.cxx @@ -23,67 +23,63 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - int otbTSARVIRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputBImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; - - typedef otb::ImageFileReader<InputRImageType> RReaderType; - typedef otb::ImageFileReader<InputBImageType> BReaderType; - typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - typedef otb::Functor::TSARVI< InputRImageType::PixelType, - InputBImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType > FunctorType; - - typedef otb::RAndBAndNIRIndexImageFilter< InputRImageType, - InputBImageType, - InputNIRImageType, - OutputImageType, - FunctorType > RAndBAndNIRIndexImageFilterType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputBImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; + + typedef otb::ImageFileReader<InputRImageType> RReaderType; + typedef otb::ImageFileReader<InputBImageType> BReaderType; + typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + + typedef otb::Functor::TSARVI<InputRImageType::PixelType, + InputBImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> FunctorType; + + typedef otb::RAndBAndNIRIndexImageFilter<InputRImageType, + InputBImageType, + InputNIRImageType, + OutputImageType, + FunctorType> RAndBAndNIRIndexImageFilterType; // Instantiating object RAndBAndNIRIndexImageFilterType::Pointer filter = RAndBAndNIRIndexImageFilterType::New(); - RReaderType::Pointer readerR = RReaderType::New(); - BReaderType::Pointer readerB = BReaderType::New(); - NIRReaderType::Pointer readerNIR = NIRReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - + RReaderType::Pointer readerR = RReaderType::New(); + BReaderType::Pointer readerB = BReaderType::New(); + NIRReaderType::Pointer readerNIR = NIRReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilenameR = argv[1]; const char * inputFilenameB = argv[2]; const char * inputFilenameNIR = argv[3]; const char * outputFilename = argv[4]; - double a(::atof(argv[5])); - double b(::atof(argv[6])); - double x(::atof(argv[7])); - double gamma(::atof(argv[8])); + double a(::atof(argv[5])); + double b(::atof(argv[6])); + double x(::atof(argv[7])); + double gamma(::atof(argv[8])); - readerR->SetFileName( inputFilenameR ); - readerB->SetFileName( inputFilenameB ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputB( readerB->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); + readerR->SetFileName(inputFilenameR); + readerB->SetFileName(inputFilenameB); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputB(readerB->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); filter->GetFunctor().SetA(a); filter->GetFunctor().SetB(b); filter->GetFunctor().SetX(x); filter->GetFunctor().SetGamma(gamma); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Radiometry/otbTerraSarBrightnessFunctor.cxx b/Testing/Code/Radiometry/otbTerraSarBrightnessFunctor.cxx index 5cb9cafd4a..9b5f4f6cf3 100644 --- a/Testing/Code/Radiometry/otbTerraSarBrightnessFunctor.cxx +++ b/Testing/Code/Radiometry/otbTerraSarBrightnessFunctor.cxx @@ -23,32 +23,31 @@ int otbTerraSarBrightnessFunctor(int argc, char * argv[]) { - char *outFilename = argv[5]; + char * outFilename = argv[5]; double calFact = atof(argv[4]); typedef double ScalarType; typedef std::complex<ScalarType> ComplexType; - typedef otb::Functor::TerraSarBrightnessFunctor<ScalarType, ScalarType> FunctorType; + typedef otb::Functor::TerraSarBrightnessFunctor<ScalarType, ScalarType> FunctorType; FunctorType funct; funct.SetCalibrationFactor(calFact); funct.SetResultsInDecibels(false); - ScalarType inPix = static_cast<ScalarType>(atof(argv[1])); + ScalarType inPix = static_cast<ScalarType>(atof(argv[1])); ComplexType inCplxPix(static_cast<ScalarType>(atof(argv[2])), static_cast<ScalarType>(atof(argv[3]))); - std::ofstream file; file.open(outFilename); file << std::fixed << std::setprecision(10); - file << "Scalar pixel : " << inPix << " -> " << funct.operator()(inPix) << std::endl; + file << "Scalar pixel : " << inPix << " -> " << funct.operator ()(inPix) << std::endl; - file << "Complex pixel : " << inCplxPix << " -> " << funct.operator()(inCplxPix) << std::endl; + file << "Complex pixel : " << inCplxPix << " -> " << funct.operator ()(inCplxPix) << std::endl; file.close(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx b/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx index d4401bc018..68937f0724 100644 --- a/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx +++ b/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx @@ -23,7 +23,6 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbTerraSarBrightnessImageComplexFilterTest(int argc, char * argv[]) { const char * inputFileName = argv[1]; @@ -31,8 +30,8 @@ int otbTerraSarBrightnessImageComplexFilterTest(int argc, char * argv[]) const bool useMetadata = atoi(argv[3]); const bool resultsInDb = atoi(argv[4]); - typedef std::complex<double> ComplexType; - typedef otb::Image<ComplexType, 2> ImageType; + typedef std::complex<double> ComplexType; + typedef otb::Image<ComplexType, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileWriter<ImageType> WriterType; typedef otb::TerraSarBrightnessImageFilter<ImageType, ImageType> FilterType; @@ -42,7 +41,6 @@ int otbTerraSarBrightnessImageComplexFilterTest(int argc, char * argv[]) WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); ExtractorType::Pointer extractor = ExtractorType::New(); - reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -50,25 +48,25 @@ int otbTerraSarBrightnessImageComplexFilterTest(int argc, char * argv[]) filter->SetInput(reader->GetOutput()); filter->SetResultsInDecibels(resultsInDb); - if( useMetadata ) + if (useMetadata) { - // Generate an extract from the large input - ImageType::RegionType region; - ImageType::IndexType id; - id[0] = atoi(argv[5]); id[1] = atoi(argv[6]); - ImageType::SizeType size; - size[0] = atoi(argv[7]); size[1] = atoi(argv[8]); - region.SetIndex(id); - region.SetSize(size); - extractor->SetExtractionRegion(region); - - extractor->SetInput(filter->GetOutput()); - writer->SetInput(extractor->GetOutput()); + // Generate an extract from the large input + ImageType::RegionType region; + ImageType::IndexType id; + id[0] = atoi(argv[5]); id[1] = atoi(argv[6]); + ImageType::SizeType size; + size[0] = atoi(argv[7]); size[1] = atoi(argv[8]); + region.SetIndex(id); + region.SetSize(size); + extractor->SetExtractionRegion(region); + + extractor->SetInput(filter->GetOutput()); + writer->SetInput(extractor->GetOutput()); } else { - filter->SetCalibrationFactor( 10 ); - writer->SetInput(filter->GetOutput()); + filter->SetCalibrationFactor(10); + writer->SetInput(filter->GetOutput()); } writer->Update(); diff --git a/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterNew.cxx b/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterNew.cxx index 7fd1abdd9c..44aeb4f610 100644 --- a/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterNew.cxx @@ -22,14 +22,13 @@ int otbTerraSarBrightnessImageFilterNew(int argc, char * argv[]) { - typedef otb::Image<double, 2> ImageType; - typedef otb::Image<std::complex<double>, 2> ComplexImageType; + typedef otb::Image<double, 2> ImageType; + typedef otb::Image<std::complex<double>, 2> ComplexImageType; typedef otb::TerraSarBrightnessImageFilter<ImageType, ImageType> FilterType; typedef otb::TerraSarBrightnessImageFilter<ComplexImageType, ComplexImageType> ComplexFilterType; - - FilterType::Pointer filter = FilterType::New(); + FilterType::Pointer filter = FilterType::New(); ComplexFilterType::Pointer complexFilter = ComplexFilterType::New(); return EXIT_SUCCESS; diff --git a/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterTest.cxx b/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterTest.cxx index 21eb605217..f2c15b0a17 100644 --- a/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterTest.cxx +++ b/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterTest.cxx @@ -23,7 +23,6 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbTerraSarBrightnessImageFilterTest(int argc, char * argv[]) { const char * inputFileName = argv[1]; @@ -41,7 +40,6 @@ int otbTerraSarBrightnessImageFilterTest(int argc, char * argv[]) WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); ExtractorType::Pointer extractor = ExtractorType::New(); - reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -49,25 +47,25 @@ int otbTerraSarBrightnessImageFilterTest(int argc, char * argv[]) filter->SetInput(reader->GetOutput()); filter->SetResultsInDecibels(resultsInDb); - if( useMetadata ) + if (useMetadata) { - // Generate an extract from the large input - ImageType::RegionType region; - ImageType::IndexType id; - id[0] = atoi(argv[5]); id[1] = atoi(argv[6]); - ImageType::SizeType size; - size[0] = atoi(argv[7]); size[1] = atoi(argv[8]); - region.SetIndex(id); - region.SetSize(size); - extractor->SetExtractionRegion(region); - - extractor->SetInput(filter->GetOutput()); - writer->SetInput(extractor->GetOutput()); + // Generate an extract from the large input + ImageType::RegionType region; + ImageType::IndexType id; + id[0] = atoi(argv[5]); id[1] = atoi(argv[6]); + ImageType::SizeType size; + size[0] = atoi(argv[7]); size[1] = atoi(argv[8]); + region.SetIndex(id); + region.SetSize(size); + extractor->SetExtractionRegion(region); + + extractor->SetInput(filter->GetOutput()); + writer->SetInput(extractor->GetOutput()); } else { - filter->SetCalibrationFactor( 10 ); - writer->SetInput(filter->GetOutput()); + filter->SetCalibrationFactor(10); + writer->SetInput(filter->GetOutput()); } writer->Update(); diff --git a/Testing/Code/Radiometry/otbTerraSarCalibrationFunctor.cxx b/Testing/Code/Radiometry/otbTerraSarCalibrationFunctor.cxx index a0fadf9d55..12da92f283 100644 --- a/Testing/Code/Radiometry/otbTerraSarCalibrationFunctor.cxx +++ b/Testing/Code/Radiometry/otbTerraSarCalibrationFunctor.cxx @@ -26,18 +26,18 @@ int otbTerraSarCalibrationFunctor(int argc, char * argv[]) typedef std::complex<ScalarType> ComplexType; typedef itk::Index<> IndexType; - typedef otb::Functor::TerraSarCalibrationFunctor<ScalarType, ScalarType> FunctorType; + typedef otb::Functor::TerraSarCalibrationFunctor<ScalarType, ScalarType> FunctorType; FunctorType funct; - + IndexType id; id[0] = 125; id[0] = 150; ScalarType inPix = 150.2; - std::cout << inPix << " -> " << funct.operator()(inPix, id, 0.) << std::endl; + std::cout << inPix << " -> " << funct.operator ()(inPix, id, 0.) << std::endl; ComplexType inCplxPix(12, 180); - std::cout << inCplxPix << " -> " << funct.operator()(inCplxPix, id,0.) << std::endl; + std::cout << inCplxPix << " -> " << funct.operator ()(inCplxPix, id, 0.) << std::endl; return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx b/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx index df4dacbba6..706a5cae7a 100644 --- a/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx +++ b/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx @@ -31,16 +31,16 @@ int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) const bool useFastCalibration = atoi(argv[3]); const bool resultsInDbs = atoi(argv[4]); - typedef std::complex<double> ComplexType; + typedef std::complex<double> ComplexType; typedef otb::Image<ComplexType, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileWriter<ImageType> WriterType; typedef otb::TerraSarCalibrationImageFilter<ImageType, ImageType> FilterType; typedef itk::ExtractImageFilter<ImageType, ImageType> ExtractorType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - FilterType::Pointer filter = FilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + FilterType::Pointer filter = FilterType::New(); ExtractorType::Pointer extractor = ExtractorType::New(); reader->SetFileName(inputFileName); @@ -52,11 +52,11 @@ int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) filter->SetUseFastCalibration(useFastCalibration); filter->SetResultsInDecibels(resultsInDbs); - if(argc == 9) + if (argc == 9) { ImageType::RegionType region; - ImageType::IndexType id; - id[0] =atoi(argv[5]); + ImageType::IndexType id; + id[0] = atoi(argv[5]); id[1] = atoi(argv[6]); ImageType::SizeType size; size[0] = atoi(argv[7]); @@ -71,8 +71,8 @@ int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) { writer->SetInput(filter->GetOutput()); } - + writer->Update(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterNew.cxx b/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterNew.cxx index 640477c37d..9ec2c2e795 100644 --- a/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterNew.cxx +++ b/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterNew.cxx @@ -22,14 +22,14 @@ int otbTerraSarCalibrationImageFilterNew(int argc, char * argv[]) { - typedef otb::Image<double, 2> ImageType; - typedef otb::Image<std::complex<double>, 2> ComplexImageType; + typedef otb::Image<double, 2> ImageType; + typedef otb::Image<std::complex<double>, 2> ComplexImageType; typedef otb::TerraSarCalibrationImageFilter<ImageType, ImageType> FilterType; typedef otb::TerraSarCalibrationImageFilter<ComplexImageType, ComplexImageType> ComplexFilterType; - - FilterType::Pointer filter = FilterType::New(); + + FilterType::Pointer filter = FilterType::New(); ComplexFilterType::Pointer complexFilter = ComplexFilterType::New(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterTest.cxx b/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterTest.cxx index cce8dbec06..23cfc16726 100644 --- a/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterTest.cxx +++ b/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterTest.cxx @@ -31,16 +31,16 @@ int otbTerraSarCalibrationImageFilterTest(int argc, char * argv[]) const bool useFastCalibration = atoi(argv[3]); const bool resultsInDbs = atoi(argv[4]); - typedef double PixelType; + typedef double PixelType; typedef otb::Image<PixelType, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileWriter<ImageType> WriterType; typedef otb::TerraSarCalibrationImageFilter<ImageType, ImageType> FilterType; typedef itk::ExtractImageFilter<ImageType, ImageType> ExtractorType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - FilterType::Pointer filter = FilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + FilterType::Pointer filter = FilterType::New(); ExtractorType::Pointer extractor = ExtractorType::New(); reader->SetFileName(inputFileName); @@ -51,12 +51,12 @@ int otbTerraSarCalibrationImageFilterTest(int argc, char * argv[]) filter->SetInput(reader->GetOutput()); filter->SetUseFastCalibration(useFastCalibration); filter->SetResultsInDecibels(resultsInDbs); - - if(argc == 9) + + if (argc == 9) { ImageType::RegionType region; - ImageType::IndexType id; - id[0] =atoi(argv[5]); + ImageType::IndexType id; + id[0] = atoi(argv[5]); id[1] = atoi(argv[6]); ImageType::SizeType size; size[0] = atoi(argv[7]); @@ -71,8 +71,8 @@ int otbTerraSarCalibrationImageFilterTest(int argc, char * argv[]) { writer->SetInput(filter->GetOutput()); } - + writer->Update(); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/Radiometry/otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter.cxx index faed04a37a..11c98ac511 100644 --- a/Testing/Code/Radiometry/otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter.cxx @@ -24,24 +24,23 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - int otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::WDVI< InputImageType::InternalPixelType, - InputImageType::InternalPixelType, - OutputImageType::PixelType > FunctorType; - typedef otb::MultiChannelRAndNIRIndexImageFilter<InputImageType,OutputImageType,FunctorType> - MultiChannelRAndNIRIndexImageFilterType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Functor::WDVI<InputImageType::InternalPixelType, + InputImageType::InternalPixelType, + OutputImageType::PixelType> FunctorType; + typedef otb::MultiChannelRAndNIRIndexImageFilter<InputImageType, OutputImageType, FunctorType> + MultiChannelRAndNIRIndexImageFilterType; // Instantiating object MultiChannelRAndNIRIndexImageFilterType::Pointer filter = MultiChannelRAndNIRIndexImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -49,20 +48,18 @@ int otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[] unsigned int redChannel(::atoi(argv[3])); unsigned int nirChannel(::atoi(argv[4])); - double s(::atof(argv[5])); + double s(::atof(argv[5])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->SetRedIndex(redChannel); filter->SetNIRIndex(nirChannel); - filter->SetInput( reader->GetOutput() ); + filter->SetInput(reader->GetOutput()); filter->GetFunctor().SetS(s); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Radiometry/otbWDVIRAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbWDVIRAndNIRVegetationIndexImageFilter.cxx index b14b0bb389..92168bc3e8 100644 --- a/Testing/Code/Radiometry/otbWDVIRAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbWDVIRAndNIRVegetationIndexImageFilter.cxx @@ -23,53 +23,49 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" - int otbWDVIRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType,Dimension> InputRImageType; - typedef otb::Image<PixelType,Dimension> InputNIRImageType; - typedef otb::Image<double,Dimension> OutputImageType; + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::Image<PixelType, Dimension> InputRImageType; + typedef otb::Image<PixelType, Dimension> InputNIRImageType; + typedef otb::Image<double, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputRImageType> RReaderType; - typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::ImageFileReader<InputRImageType> RReaderType; + typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Functor::WDVI< InputRImageType::PixelType, - InputNIRImageType::PixelType, - OutputImageType::PixelType > FunctorType; + typedef otb::Functor::WDVI<InputRImageType::PixelType, + InputNIRImageType::PixelType, + OutputImageType::PixelType> FunctorType; - typedef otb::RAndNIRIndexImageFilter< InputRImageType, - InputNIRImageType, - OutputImageType, - FunctorType > RAndNIRIndexImageFilterType; + typedef otb::RAndNIRIndexImageFilter<InputRImageType, + InputNIRImageType, + OutputImageType, + FunctorType> RAndNIRIndexImageFilterType; // Instantiating object RAndNIRIndexImageFilterType::Pointer filter = RAndNIRIndexImageFilterType::New(); - RReaderType::Pointer readerR = RReaderType::New(); - NIRReaderType::Pointer readerNIR = NIRReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - + RReaderType::Pointer readerR = RReaderType::New(); + NIRReaderType::Pointer readerNIR = NIRReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilenameR = argv[1]; const char * inputFilenameNIR = argv[2]; const char * outputFilename = argv[3]; - double s(::atof(argv[4])); + double s(::atof(argv[4])); - readerR->SetFileName( inputFilenameR ); - readerNIR->SetFileName( inputFilenameNIR ); - writer->SetFileName( outputFilename ); - filter->SetInputR( readerR->GetOutput() ); - filter->SetInputNIR( readerNIR->GetOutput() ); + readerR->SetFileName(inputFilenameR); + readerNIR->SetFileName(inputFilenameNIR); + writer->SetFileName(outputFilename); + filter->SetInputR(readerR->GetOutput()); + filter->SetInputNIR(readerNIR->GetOutput()); filter->GetFunctor().SetS(s); - writer->SetInput( filter->GetOutput() ); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - diff --git a/Testing/Code/Radiometry/otbWaterSqrtSpectralAngleImageFilter.cxx b/Testing/Code/Radiometry/otbWaterSqrtSpectralAngleImageFilter.cxx index 9a5dc70f3e..3fd1b5d490 100644 --- a/Testing/Code/Radiometry/otbWaterSqrtSpectralAngleImageFilter.cxx +++ b/Testing/Code/Radiometry/otbWaterSqrtSpectralAngleImageFilter.cxx @@ -23,25 +23,22 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" - int otbWaterSqrtSpectralAngleImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<double ,Dimension> InputImageType; - typedef otb::Image<double,Dimension> OutputImageType; + typedef otb::VectorImage<double, Dimension> InputImageType; + typedef otb::Image<double, Dimension> OutputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - - typedef otb::WaterSqrtSpectralAngleImageFilter<InputImageType,OutputImageType> + typedef otb::WaterSqrtSpectralAngleImageFilter<InputImageType, OutputImageType> WaterSqrtSpectralAngleImageFilterType; - // Instantiating objects WaterSqrtSpectralAngleImageFilterType::Pointer filter = WaterSqrtSpectralAngleImageFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -51,19 +48,18 @@ int otbWaterSqrtSpectralAngleImageFilter(int argc, char * argv[]) unsigned int redChannel(::atoi(argv[5])); unsigned int nirChannel(::atoi(argv[6])); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); filter->GetFunctor().SetBlueChannel(blueChannel); filter->GetFunctor().SetGreenChannel(greenChannel); filter->GetFunctor().SetRedChannel(redChannel); filter->GetFunctor().SetNIRChannel(nirChannel); - filter->SetInput( reader->GetOutput() ); - writer->SetInput( filter->GetOutput() ); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SARPolarimetry/otbHHnHVPolarimetricSynthesisFilter.cxx b/Testing/Code/SARPolarimetry/otbHHnHVPolarimetricSynthesisFilter.cxx index 2e0d6d488f..78e528a27e 100644 --- a/Testing/Code/SARPolarimetry/otbHHnHVPolarimetricSynthesisFilter.cxx +++ b/Testing/Code/SARPolarimetry/otbHHnHVPolarimetricSynthesisFilter.cxx @@ -28,56 +28,51 @@ #include "otbImageFileWriter.h" #include "otbPolarimetricSynthesisFilter.h" - -int otbHHnHVPolarimetricSynthesisFilter( int argc, char * argv[] ) +int otbHHnHVPolarimetricSynthesisFilter(int argc, char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; const char * outputFilename = argv[3]; - double PsiI = strtod(argv[4],NULL); - double KhiI = strtod(argv[5],NULL); - double PsiR = strtod(argv[6],NULL); - double KhiR = strtod(argv[7],NULL); - - - typedef std::complex <double> InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + double PsiI = strtod(argv[4], NULL); + double KhiI = strtod(argv[5], NULL); + double PsiR = strtod(argv[6], NULL); + double KhiR = strtod(argv[7], NULL); - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef std::complex <double> InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::PolarimetricSynthesisFilter< InputImageType,InputImageType,InputImageType,InputImageType,OutputImageType > FilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::PolarimetricSynthesisFilter<InputImageType, InputImageType, InputImageType, InputImageType, + OutputImageType> FilterType; FilterType::Pointer polarimetricSynthesis = FilterType::New(); - polarimetricSynthesis->SetPsiI( PsiI ); - polarimetricSynthesis->SetKhiI( KhiI ); - polarimetricSynthesis->SetPsiR( PsiR ); - polarimetricSynthesis->SetKhiR( KhiR ); + polarimetricSynthesis->SetPsiI(PsiI); + polarimetricSynthesis->SetKhiI(KhiI); + polarimetricSynthesis->SetPsiR(PsiR); + polarimetricSynthesis->SetKhiR(KhiR); ReaderType::Pointer reader1 = ReaderType::New(); ReaderType::Pointer reader2 = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); - polarimetricSynthesis->SetInputHH( reader1->GetOutput() ); - polarimetricSynthesis->SetInputHV( reader2->GetOutput() ); - writer->SetInput( polarimetricSynthesis->GetOutput() ); + polarimetricSynthesis->SetInputHH(reader1->GetOutput()); + polarimetricSynthesis->SetInputHV(reader2->GetOutput()); + writer->SetInput(polarimetricSynthesis->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/SARPolarimetry/otbHHnHVnVVPolarimetricSynthesisFilter.cxx b/Testing/Code/SARPolarimetry/otbHHnHVnVVPolarimetricSynthesisFilter.cxx index a4db3be847..590e45c45a 100644 --- a/Testing/Code/SARPolarimetry/otbHHnHVnVVPolarimetricSynthesisFilter.cxx +++ b/Testing/Code/SARPolarimetry/otbHHnHVnVVPolarimetricSynthesisFilter.cxx @@ -28,8 +28,7 @@ #include "otbImageFileWriter.h" #include "otbPolarimetricSynthesisFilter.h" - -int otbHHnHVnVVPolarimetricSynthesisFilter( int argc, char * argv[] ) +int otbHHnHVnVVPolarimetricSynthesisFilter(int argc, char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; @@ -37,51 +36,47 @@ int otbHHnHVnVVPolarimetricSynthesisFilter( int argc, char * argv[] ) const char * outputFilename = argv[4]; - double PsiI = strtod(argv[5],NULL); - double KhiI = strtod(argv[6],NULL); - double PsiR = strtod(argv[7],NULL); - double KhiR = strtod(argv[8],NULL); - - - typedef std::complex <double> InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + double PsiI = strtod(argv[5], NULL); + double KhiI = strtod(argv[6], NULL); + double PsiR = strtod(argv[7], NULL); + double KhiR = strtod(argv[8], NULL); - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef std::complex <double> InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::PolarimetricSynthesisFilter< InputImageType,InputImageType,InputImageType,InputImageType,OutputImageType > FilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::PolarimetricSynthesisFilter<InputImageType, InputImageType, InputImageType, InputImageType, + OutputImageType> FilterType; FilterType::Pointer polarimetricSynthesis = FilterType::New(); - polarimetricSynthesis->SetPsiI( PsiI ); - polarimetricSynthesis->SetKhiI( KhiI ); - polarimetricSynthesis->SetPsiR( PsiR ); - polarimetricSynthesis->SetKhiR( KhiR ); + polarimetricSynthesis->SetPsiI(PsiI); + polarimetricSynthesis->SetKhiI(KhiI); + polarimetricSynthesis->SetPsiR(PsiR); + polarimetricSynthesis->SetKhiR(KhiR); ReaderType::Pointer reader1 = ReaderType::New(); ReaderType::Pointer reader2 = ReaderType::New(); ReaderType::Pointer reader3 = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - reader3->SetFileName( inputFilename3 ); - writer->SetFileName( outputFilename ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + reader3->SetFileName(inputFilename3); + writer->SetFileName(outputFilename); - polarimetricSynthesis->SetInputHH( reader1->GetOutput() ); - polarimetricSynthesis->SetInputHV( reader2->GetOutput() ); - polarimetricSynthesis->SetInputVV( reader3->GetOutput() ); - writer->SetInput( polarimetricSynthesis->GetOutput() ); + polarimetricSynthesis->SetInputHH(reader1->GetOutput()); + polarimetricSynthesis->SetInputHV(reader2->GetOutput()); + polarimetricSynthesis->SetInputVV(reader3->GetOutput()); + writer->SetInput(polarimetricSynthesis->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.cxx b/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.cxx index a3a581aea9..0d102197e3 100644 --- a/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.cxx +++ b/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.cxx @@ -28,8 +28,7 @@ #include "otbImageFileWriter.h" #include "otbMultiChannelsPolarimetricSynthesisFilter.h" - -int otbMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] ) +int otbMultiChannelsPolarimetricSynthesisFilter(int argc, char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; @@ -37,41 +36,40 @@ int otbMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] ) const char * outputFilename = argv[4]; - double PsiI = strtod(argv[5],NULL); - double KhiI = strtod(argv[6],NULL); - double PsiR = strtod(argv[7],NULL); - double KhiR = strtod(argv[8],NULL); - + double PsiI = strtod(argv[5], NULL); + double KhiI = strtod(argv[6], NULL); + double PsiR = strtod(argv[7], NULL); + double KhiR = strtod(argv[8], NULL); - typedef std::complex <double> InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef std::complex <double> InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::VectorImage< InputPixelType, Dimension > InputVectorImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputVectorImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::MultiChannelsPolarimetricSynthesisFilter< InputVectorImageType,OutputImageType > FilterType; + typedef otb::MultiChannelsPolarimetricSynthesisFilter<InputVectorImageType, OutputImageType> FilterType; FilterType::Pointer polarimetricSynthesis = FilterType::New(); - polarimetricSynthesis->SetPsiI( PsiI ); - polarimetricSynthesis->SetKhiI( KhiI ); - polarimetricSynthesis->SetPsiR( PsiR ); - polarimetricSynthesis->SetKhiR( KhiR ); + polarimetricSynthesis->SetPsiI(PsiI); + polarimetricSynthesis->SetKhiI(KhiI); + polarimetricSynthesis->SetPsiR(PsiR); + polarimetricSynthesis->SetKhiR(KhiR); ReaderType::Pointer reader1 = ReaderType::New(); ReaderType::Pointer reader2 = ReaderType::New(); ReaderType::Pointer reader3 = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - reader3->SetFileName( inputFilename3 ); - writer->SetFileName( outputFilename ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + reader3->SetFileName(inputFilename3); + writer->SetFileName(outputFilename); reader1->Update(); reader2->Update(); @@ -80,8 +78,8 @@ int otbMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] ) InputVectorImageType::Pointer outputPtr = InputVectorImageType::New(); InputVectorImageType::IndexType start; - start[0]=0; - start[1]=0; + start[0] = 0; + start[1] = 0; InputVectorImageType::SizeType size = reader1->GetOutput()->GetLargestPossibleRegion().GetSize(); @@ -93,7 +91,7 @@ int otbMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] ) outputPtr->Allocate(); InputVectorImageType::PixelType pix0; pix0.SetSize(3); - InputPixelType complexpix(0,0); + InputPixelType complexpix(0, 0); pix0.Fill(complexpix); outputPtr->FillBuffer(pix0); @@ -101,9 +99,12 @@ int otbMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] ) InputVectorImageType::Pointer vectorImage = InputVectorImageType::New(); // Copy of the pictures in a vector - itk::ImageRegionConstIterator<InputImageType> inputIt1(reader1->GetOutput(), reader1->GetOutput()->GetLargestPossibleRegion()); - itk::ImageRegionConstIterator<InputImageType> inputIt2(reader2->GetOutput(), reader2->GetOutput()->GetLargestPossibleRegion()); - itk::ImageRegionConstIterator<InputImageType> inputIt3(reader3->GetOutput(), reader3->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionConstIterator<InputImageType> inputIt1(reader1->GetOutput(), + reader1->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionConstIterator<InputImageType> inputIt2(reader2->GetOutput(), + reader2->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionConstIterator<InputImageType> inputIt3(reader3->GetOutput(), + reader3->GetOutput()->GetLargestPossibleRegion()); itk::ImageRegionIterator<InputVectorImageType> outputIt(outputPtr, outputPtr->GetLargestPossibleRegion()); inputIt1.GoToBegin(); @@ -111,28 +112,25 @@ int otbMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] ) inputIt3.GoToBegin(); outputIt.GoToBegin(); - while ( !inputIt1.IsAtEnd() ) - { + while (!inputIt1.IsAtEnd()) + { InputVectorImageType::PixelType pix; pix.SetSize(4); - pix[0]=inputIt1.Get(); - pix[1]=inputIt2.Get(); - pix[2]=inputIt3.Get(); + pix[0] = inputIt1.Get(); + pix[1] = inputIt2.Get(); + pix[2] = inputIt3.Get(); - outputIt.Set( pix ); + outputIt.Set(pix); ++inputIt1; ++inputIt2; ++inputIt3; ++outputIt; - } + } polarimetricSynthesis->SetInput(outputPtr); - writer->SetInput( polarimetricSynthesis->GetOutput() ); + writer->SetInput(polarimetricSynthesis->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilterNew.cxx b/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilterNew.cxx index 63542ccfb4..16ee6ce607 100644 --- a/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilterNew.cxx +++ b/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilterNew.cxx @@ -26,20 +26,18 @@ #include "otbVectorImage.h" #include "otbMultiChannelsPolarimetricSynthesisFilter.h" -int otbMultiChannelsPolarimetricSynthesisFilterNew( int argc, char * argv[] ) +int otbMultiChannelsPolarimetricSynthesisFilterNew(int argc, char * argv[]) { - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::MultiChannelsPolarimetricSynthesisFilter< InputImageType,OutputImageType > FilterType; + typedef otb::MultiChannelsPolarimetricSynthesisFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFilter.cxx b/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFilter.cxx index 436e7b8b49..7a838d9b9a 100644 --- a/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFilter.cxx +++ b/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFilter.cxx @@ -28,8 +28,7 @@ #include "otbImageFileWriter.h" #include "otbPolarimetricSynthesisFilter.h" - -int otbPolarimetricSynthesisFilter( int argc, char * argv[] ) +int otbPolarimetricSynthesisFilter(int argc, char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; @@ -38,30 +37,30 @@ int otbPolarimetricSynthesisFilter( int argc, char * argv[] ) const char * outputFilename = argv[5]; - double PsiI = strtod(argv[6],NULL); - double KhiI = strtod(argv[7],NULL); - double PsiR = strtod(argv[8],NULL); - double KhiR = strtod(argv[9],NULL); - - typedef std::complex <double> InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + double PsiI = strtod(argv[6], NULL); + double KhiI = strtod(argv[7], NULL); + double PsiR = strtod(argv[8], NULL); + double KhiR = strtod(argv[9], NULL); - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef std::complex <double> InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::PolarimetricSynthesisFilter< InputImageType,InputImageType,InputImageType,InputImageType,OutputImageType > FilterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::PolarimetricSynthesisFilter<InputImageType, InputImageType, InputImageType, InputImageType, + OutputImageType> FilterType; FilterType::Pointer polarimetricSynthesis = FilterType::New(); - polarimetricSynthesis->SetPsiI( PsiI ); - polarimetricSynthesis->SetKhiI( KhiI ); - polarimetricSynthesis->SetPsiR( PsiR ); - polarimetricSynthesis->SetKhiR( KhiR ); + polarimetricSynthesis->SetPsiI(PsiI); + polarimetricSynthesis->SetKhiI(KhiI); + polarimetricSynthesis->SetPsiR(PsiR); + polarimetricSynthesis->SetKhiR(KhiR); ReaderType::Pointer reader1 = ReaderType::New(); ReaderType::Pointer reader2 = ReaderType::New(); @@ -69,23 +68,19 @@ int otbPolarimetricSynthesisFilter( int argc, char * argv[] ) ReaderType::Pointer reader4 = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + reader3->SetFileName(inputFilename3); + reader4->SetFileName(inputFilename4); + writer->SetFileName(outputFilename); - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - reader3->SetFileName( inputFilename3 ); - reader4->SetFileName( inputFilename4 ); - writer->SetFileName( outputFilename ); - - polarimetricSynthesis->SetInputHH( reader1->GetOutput() ); - polarimetricSynthesis->SetInputHV( reader2->GetOutput() ); - polarimetricSynthesis->SetInputVH( reader3->GetOutput() ); - polarimetricSynthesis->SetInputVV( reader4->GetOutput() ); - writer->SetInput( polarimetricSynthesis->GetOutput() ); + polarimetricSynthesis->SetInputHH(reader1->GetOutput()); + polarimetricSynthesis->SetInputHV(reader2->GetOutput()); + polarimetricSynthesis->SetInputVH(reader3->GetOutput()); + polarimetricSynthesis->SetInputVV(reader4->GetOutput()); + writer->SetInput(polarimetricSynthesis->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFilterNew.cxx b/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFilterNew.cxx index 97cb64b105..862369cadf 100644 --- a/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFilterNew.cxx +++ b/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFilterNew.cxx @@ -26,20 +26,19 @@ #include "otbVectorImage.h" #include "otbPolarimetricSynthesisFilter.h" -int otbPolarimetricSynthesisFilterNew( int argc, char * argv[] ) +int otbPolarimetricSynthesisFilterNew(int argc, char * argv[]) { typedef std::complex<double> InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::PolarimetricSynthesisFilter< InputImageType,InputImageType,InputImageType,InputImageType,OutputImageType > FilterType; + typedef otb::PolarimetricSynthesisFilter<InputImageType, InputImageType, InputImageType, InputImageType, + OutputImageType> FilterType; FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/SARPolarimetry/otbSARPolarimetryTests1.cxx b/Testing/Code/SARPolarimetry/otbSARPolarimetryTests1.cxx index e52c782d5e..feebb6b9bf 100644 --- a/Testing/Code/SARPolarimetry/otbSARPolarimetryTests1.cxx +++ b/Testing/Code/SARPolarimetry/otbSARPolarimetryTests1.cxx @@ -22,7 +22,6 @@ #pragma warning ( disable : 4786 ) #endif - #include "otbTestMain.h" void RegisterTests() @@ -35,4 +34,3 @@ void RegisterTests() REGISTER_TEST(otbMultiChannelsPolarimetricSynthesisFilter); REGISTER_TEST(otbVectorMultiChannelsPolarimetricSynthesisFilter); } - diff --git a/Testing/Code/SARPolarimetry/otbVHnVVPolarimetricSynthesisFilter.cxx b/Testing/Code/SARPolarimetry/otbVHnVVPolarimetricSynthesisFilter.cxx index 6afab82f9e..72eb18fd51 100644 --- a/Testing/Code/SARPolarimetry/otbVHnVVPolarimetricSynthesisFilter.cxx +++ b/Testing/Code/SARPolarimetry/otbVHnVVPolarimetricSynthesisFilter.cxx @@ -28,56 +28,54 @@ #include "otbImageFileWriter.h" #include "otbPolarimetricSynthesisFilter.h" - -int otbVHnVVPolarimetricSynthesisFilter( int argc, char * argv[] ) +int otbVHnVVPolarimetricSynthesisFilter(int argc, char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; const char * outputFilename = argv[3]; - double PsiI = strtod(argv[4],NULL); - double KhiI = strtod(argv[5],NULL); - double PsiR = strtod(argv[6],NULL); - double KhiR = strtod(argv[7],NULL); + double PsiI = strtod(argv[4], NULL); + double KhiI = strtod(argv[5], NULL); + double PsiR = strtod(argv[6], NULL); + double KhiR = strtod(argv[7], NULL); - typedef std::complex <double> InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + typedef std::complex <double> InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::PolarimetricSynthesisFilter< InputImageType,InputImageType,InputImageType,InputImageType,OutputImageType > FilterType; + typedef otb::PolarimetricSynthesisFilter<InputImageType, InputImageType, InputImageType, InputImageType, + OutputImageType> FilterType; FilterType::Pointer polarimetricSynthesis = FilterType::New(); - polarimetricSynthesis->SetPsiI( PsiI ); - polarimetricSynthesis->SetKhiI( KhiI ); - polarimetricSynthesis->SetPsiR( PsiR ); - polarimetricSynthesis->SetKhiR( KhiR ); + polarimetricSynthesis->SetPsiI(PsiI); + polarimetricSynthesis->SetKhiI(KhiI); + polarimetricSynthesis->SetPsiR(PsiR); + polarimetricSynthesis->SetKhiR(KhiR); ReaderType::Pointer reader1 = ReaderType::New(); ReaderType::Pointer reader2 = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader1->SetFileName( inputFilename1 ); - reader2->SetFileName( inputFilename2 ); - writer->SetFileName( outputFilename ); + reader1->SetFileName(inputFilename1); + reader2->SetFileName(inputFilename2); + writer->SetFileName(outputFilename); - polarimetricSynthesis->SetInputVH( reader1->GetOutput() ); - polarimetricSynthesis->SetInputVV( reader2->GetOutput() ); + polarimetricSynthesis->SetInputVH(reader1->GetOutput()); + polarimetricSynthesis->SetInputVV(reader2->GetOutput()); - std::cout<<polarimetricSynthesis->GetNumberOfValidRequiredInputs()<<std::endl; - std::cout<<polarimetricSynthesis->GetInputs().size()<<std::endl; + std::cout << polarimetricSynthesis->GetNumberOfValidRequiredInputs() << std::endl; + std::cout << polarimetricSynthesis->GetInputs().size() << std::endl; - writer->SetInput( polarimetricSynthesis->GetOutput() ); + writer->SetInput(polarimetricSynthesis->GetOutput()); writer->Update(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/SARPolarimetry/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx b/Testing/Code/SARPolarimetry/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx index f93450fc88..3060106a2d 100644 --- a/Testing/Code/SARPolarimetry/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx +++ b/Testing/Code/SARPolarimetry/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx @@ -28,49 +28,45 @@ #include "otbImageFileWriter.h" #include "otbMultiChannelsPolarimetricSynthesisFilter.h" - -int otbVectorMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] ) +int otbVectorMultiChannelsPolarimetricSynthesisFilter(int argc, char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - double PsiI = strtod(argv[3],NULL); - double KhiI = strtod(argv[4],NULL); - double PsiR = strtod(argv[5],NULL); - double KhiR = strtod(argv[6],NULL); - - typedef std::complex <double> InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::FixedArray<int,4> IndexArrayType; - typedef otb::MultiChannelsPolarimetricSynthesisFilter< InputImageType,OutputImageType > FilterType; + double PsiI = strtod(argv[3], NULL); + double KhiI = strtod(argv[4], NULL); + double PsiR = strtod(argv[5], NULL); + double KhiR = strtod(argv[6], NULL); + + typedef std::complex <double> InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; + typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef itk::FixedArray<int, 4> IndexArrayType; + typedef otb::MultiChannelsPolarimetricSynthesisFilter<InputImageType, OutputImageType> FilterType; FilterType::Pointer polarimetricSynthesis = FilterType::New(); - polarimetricSynthesis->SetPsiI( PsiI ); - polarimetricSynthesis->SetKhiI( KhiI ); - polarimetricSynthesis->SetPsiR( PsiR ); - polarimetricSynthesis->SetKhiR( KhiR ); - polarimetricSynthesis->SetEmissionH( true ); - polarimetricSynthesis->SetEmissionV( true ); + polarimetricSynthesis->SetPsiI(PsiI); + polarimetricSynthesis->SetKhiI(KhiI); + polarimetricSynthesis->SetPsiR(PsiR); + polarimetricSynthesis->SetKhiR(KhiR); + polarimetricSynthesis->SetEmissionH(true); + polarimetricSynthesis->SetEmissionV(true); ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); polarimetricSynthesis->SetInput(reader->GetOutput()); - writer->SetInput( polarimetricSynthesis->GetOutput() ); + writer->SetInput(polarimetricSynthesis->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/SpatialReasoning/otbImageListToRCC8GraphFilterNew.cxx b/Testing/Code/SpatialReasoning/otbImageListToRCC8GraphFilterNew.cxx index cb6f1676b0..a2eac39e44 100644 --- a/Testing/Code/SpatialReasoning/otbImageListToRCC8GraphFilterNew.cxx +++ b/Testing/Code/SpatialReasoning/otbImageListToRCC8GraphFilterNew.cxx @@ -25,17 +25,16 @@ int otbImageListToRCC8GraphFilterNew(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef unsigned short LabelPixelType; - typedef otb::Polygon<> PathType; - typedef otb::Image<LabelPixelType,Dimension> LabelImageType; - typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; - typedef otb::ImageListToRCC8GraphFilter<LabelImageType,RCC8GraphType> + typedef unsigned short LabelPixelType; + typedef otb::Polygon<> PathType; + typedef otb::Image<LabelPixelType, Dimension> LabelImageType; + typedef otb::RCC8VertexBase<PathType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::ImageListToRCC8GraphFilter<LabelImageType, RCC8GraphType> ImageListToRCC8GraphFilterType; // Instantiation ImageListToRCC8GraphFilterType::Pointer filter = ImageListToRCC8GraphFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.cxx b/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.cxx index d74a794d4d..f640ff2529 100644 --- a/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.cxx +++ b/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.cxx @@ -28,37 +28,37 @@ int otbImageMultiSegmentationToRCC8GraphFilter(int argc, char* argv[]) { const unsigned int Dimension = 2; - char * outputFilename = argv[1]; - int useOptimisation = atoi(argv[2]); - unsigned int nbImages = atoi(argv[3]); + char * outputFilename = argv[1]; + int useOptimisation = atoi(argv[2]); + unsigned int nbImages = atoi(argv[3]); // typedefs - typedef unsigned short LabelPixelType; - typedef otb::Image<LabelPixelType,Dimension> LabelImageType; - typedef otb::Polygon<> PolygonType; - typedef otb::RCC8VertexBase<PolygonType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; - typedef otb::ImageMultiSegmentationToRCC8GraphFilter<LabelImageType,RCC8GraphType> + typedef unsigned short LabelPixelType; + typedef otb::Image<LabelPixelType, Dimension> LabelImageType; + typedef otb::Polygon<> PolygonType; + typedef otb::RCC8VertexBase<PolygonType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::ImageMultiSegmentationToRCC8GraphFilter<LabelImageType, RCC8GraphType> RCC8GraphFilterType; - typedef otb::ImageList<LabelImageType> ImageListType; - typedef otb::ImageFileReader<LabelImageType> ReaderType; + typedef otb::ImageList<LabelImageType> ImageListType; + typedef otb::ImageFileReader<LabelImageType> ReaderType; typedef otb::RCC8GraphFileWriter<RCC8GraphType> GraphWriterType; ImageListType::Pointer inputList = ImageListType::New(); // Reading input images - for (unsigned int i=0;i<nbImages;i++) - { + for (unsigned int i = 0; i < nbImages; i++) + { ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(argv[4+i]); + reader->SetFileName(argv[4 + i]); reader->Update(); inputList->PushBack(reader->GetOutput()); - } - std::cout<<"Input image loaded into images list."<<std::endl; + } + std::cout << "Input image loaded into images list." << std::endl; // Instantiation RCC8GraphFilterType::Pointer filter = RCC8GraphFilterType::New(); filter->SetInput(inputList); - filter->SetOptimisation(useOptimisation>0); + filter->SetOptimisation(useOptimisation > 0); // Writing output graph GraphWriterType::Pointer writer = GraphWriterType::New(); @@ -66,6 +66,5 @@ int otbImageMultiSegmentationToRCC8GraphFilter(int argc, char* argv[]) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilterNew.cxx b/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilterNew.cxx index 5853448493..b636e6dd3c 100644 --- a/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilterNew.cxx +++ b/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilterNew.cxx @@ -25,17 +25,16 @@ int otbImageMultiSegmentationToRCC8GraphFilterNew(int argc, char* argv[]) { const unsigned int Dimension = 2; - typedef unsigned short LabelPixelType; - typedef otb::Polygon<> PolygonType; - typedef otb::Image<LabelPixelType,Dimension> LabelImageType; - typedef otb::RCC8VertexBase<PolygonType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; - typedef otb::ImageMultiSegmentationToRCC8GraphFilter<LabelImageType,RCC8GraphType> + typedef unsigned short LabelPixelType; + typedef otb::Polygon<> PolygonType; + typedef otb::Image<LabelPixelType, Dimension> LabelImageType; + typedef otb::RCC8VertexBase<PolygonType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::ImageMultiSegmentationToRCC8GraphFilter<LabelImageType, RCC8GraphType> RCC8GraphFilterType; // Instantiation RCC8GraphFilterType::Pointer filter = RCC8GraphFilterType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbImageToImageRCC8Calculator.cxx b/Testing/Code/SpatialReasoning/otbImageToImageRCC8Calculator.cxx index 89168d8642..ea09df2e04 100644 --- a/Testing/Code/SpatialReasoning/otbImageToImageRCC8Calculator.cxx +++ b/Testing/Code/SpatialReasoning/otbImageToImageRCC8Calculator.cxx @@ -28,80 +28,80 @@ int otbImageToImageRCC8Calculator(int argc, char* argv[]) int nbImages = atoi(argv[1]); char * outfile = argv[2]; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef unsigned char PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageToImageRCC8Calculator<ImageType> CalculatorType; - typedef otb::ImageList<ImageType> ImageListType; - typedef ImageListType::Iterator IteratorType; + typedef otb::ImageList<ImageType> ImageListType; + typedef ImageListType::Iterator IteratorType; // reference image list ImageListType::Pointer images = ImageListType::New(); // Reading input images std::ofstream out; - out.open(outfile,std::ios::out); - out<<"Test results from otbImageToImageRCC8calculator test."<<std::endl; - for (int k=1;k<=nbImages;++k) - { + out.open(outfile, std::ios::out); + out << "Test results from otbImageToImageRCC8calculator test." << std::endl; + for (int k = 1; k <= nbImages; ++k) + { ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(argv[2+k]); + reader->SetFileName(argv[2 + k]); reader->Update(); images->PushBack(reader->GetOutput()); - } + } // Declaration - CalculatorType::Pointer calc,calc1,calc2; + CalculatorType::Pointer calc, calc1, calc2; // Computing relations for each images couple int i = 1; int j = 1; - for (IteratorType it1=images->Begin();it1!=images->End();++it1) - { - for (IteratorType it2=images->Begin();it2!=images->End();++it2) + for (IteratorType it1 = images->Begin(); it1 != images->End(); ++it1) { - std::cout << "Test: computing relation " << i <<","<< j << std::endl; - calc=CalculatorType::New(); + for (IteratorType it2 = images->Begin(); it2 != images->End(); ++it2) + { + std::cout << "Test: computing relation " << i << "," << j << std::endl; + calc = CalculatorType::New(); calc->SetInput1(it1.Get()); calc->SetInput2(it2.Get()); calc->Update(); - out<<calc->GetValue()<<"\t"; + out << calc->GetValue() << "\t"; - if (calc->GetValue()<3 - ||calc->GetValue()==4 - ||calc->GetValue()==6) - { - calc1=CalculatorType::New(); + if (calc->GetValue() < 3 + || calc->GetValue() == 4 + || calc->GetValue() == 6) + { + calc1 = CalculatorType::New(); calc1->SetInput1(it1.Get()); calc1->SetInput2(it2.Get()); calc1->SetLevel1APrioriKnowledge(true); calc1->Update(); - if (calc1->GetValue()!=calc->GetValue()) - { - std::cout<<"Test failed: Result with level1AprioriKnowledge "; - std::cout<<"different from result without a priori knowledge"<<std::endl; - std::cout<<calc->GetValue()<<"!="<<calc1->GetValue()<<std::endl; + if (calc1->GetValue() != calc->GetValue()) + { + std::cout << "Test failed: Result with level1AprioriKnowledge "; + std::cout << "different from result without a priori knowledge" << std::endl; + std::cout << calc->GetValue() << "!=" << calc1->GetValue() << std::endl; return EXIT_FAILURE; + } } - } - if (calc->GetValue()<4) - { - calc2=CalculatorType::New(); + if (calc->GetValue() < 4) + { + calc2 = CalculatorType::New(); calc2->SetInput1(it1.Get()); calc2->SetInput2(it2.Get()); calc2->SetLevel3APrioriKnowledge(true); calc2->Update(); - if (calc2->GetValue()!=calc->GetValue()) - { - std::cout<<"Test failed: Result with level3AprioriKnowledge "; - std::cout<<"different from result without a priori knowledge"<<std::endl; - std::cout<<calc->GetValue()<<"!="<<calc1->GetValue()<<std::endl; + if (calc2->GetValue() != calc->GetValue()) + { + std::cout << "Test failed: Result with level3AprioriKnowledge "; + std::cout << "different from result without a priori knowledge" << std::endl; + std::cout << calc->GetValue() << "!=" << calc1->GetValue() << std::endl; return EXIT_FAILURE; + } } - } j++; - } - j=1; + } + j = 1; i++; - out<<std::endl; - } + out << std::endl; + } out.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx b/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx index 21bc863953..c5f0e5bb87 100644 --- a/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx +++ b/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx @@ -37,50 +37,49 @@ int otbPolygonListToRCC8GraphFilter(int argc, char* argv[]) char * outfile = argv[2]; // typedefs - typedef otb::Polygon<> PolygonType; - typedef otb::ObjectList<PolygonType> PolygonListType; - typedef otb::RCC8VertexBase<PolygonType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; - typedef otb::PolygonListToRCC8GraphFilter<PolygonListType,RCC8GraphType> RCC8GraphFilterType; - typedef otb::RCC8GraphFileWriter<RCC8GraphType> GraphWriterType; - - typedef unsigned short PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageToEdgePathFilter<ImageType,PolygonType> EdgeExtractionFilterType; - typedef itk::MinimumMaximumImageCalculator<ImageType> MinMaxCalculatorType; - typedef otb::SimplifyPathListFilter<PolygonType> SimplifyPathFilterType; + typedef otb::Polygon<> PolygonType; + typedef otb::ObjectList<PolygonType> PolygonListType; + typedef otb::RCC8VertexBase<PolygonType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::PolygonListToRCC8GraphFilter<PolygonListType, RCC8GraphType> RCC8GraphFilterType; + typedef otb::RCC8GraphFileWriter<RCC8GraphType> GraphWriterType; + + typedef unsigned short PixelType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageToEdgePathFilter<ImageType, PolygonType> EdgeExtractionFilterType; + typedef itk::MinimumMaximumImageCalculator<ImageType> MinMaxCalculatorType; + typedef otb::SimplifyPathListFilter<PolygonType> SimplifyPathFilterType; PolygonListType::Pointer regions = PolygonListType::New(); RCC8GraphFilterType::SegmentationRangesType ranges; - // Reading input images - for (int cpt=1;cpt<=nbImages;++cpt) - { + for (int cpt = 1; cpt <= nbImages; ++cpt) + { ranges.push_back(regions->Size()); ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(argv[2+cpt]); + reader->SetFileName(argv[2 + cpt]); reader->Update(); MinMaxCalculatorType::Pointer minMax = MinMaxCalculatorType::New(); minMax->SetImage(reader->GetOutput()); minMax->Compute(); - for (PixelType p = minMax->GetMinimum();p<=minMax->GetMaximum();++p) - { - if (p!=0) + for (PixelType p = minMax->GetMinimum(); p <= minMax->GetMaximum(); ++p) { + if (p != 0) + { EdgeExtractionFilterType::Pointer extraction = EdgeExtractionFilterType::New(); extraction->SetInput(reader->GetOutput()); extraction->SetForegroundValue(p); extraction->Update(); - if (extraction->GetOutput()->GetVertexList()->Size()>2) - { + if (extraction->GetOutput()->GetVertexList()->Size() > 2) + { regions->PushBack(extraction->GetOutput()); + } } } } - } // Simplifying regions SimplifyPathFilterType::Pointer simplifier = SimplifyPathFilterType::New(); diff --git a/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilterNew.cxx b/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilterNew.cxx index 67d696aa6c..3574f8c919 100644 --- a/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilterNew.cxx +++ b/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilterNew.cxx @@ -25,11 +25,11 @@ int otbPolygonListToRCC8GraphFilterNew(int argc, char* argv[]) { // typedefs - typedef otb::Polygon<> PolygonType; - typedef otb::ObjectList<PolygonType> PolygonListType; + typedef otb::Polygon<> PolygonType; + typedef otb::ObjectList<PolygonType> PolygonListType; typedef otb::RCC8VertexBase<PolygonType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; - typedef otb::PolygonListToRCC8GraphFilter<PolygonListType,RCC8GraphType> + typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::PolygonListToRCC8GraphFilter<PolygonListType, RCC8GraphType> RCC8GraphFilterType; // Instantiation diff --git a/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx b/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx index d1f6afb523..d1530975c6 100644 --- a/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx +++ b/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx @@ -31,37 +31,36 @@ int otbPolygonToPolygonRCC8Calculator(int argc, char* argv[]) int nbImages = atoi(argv[1]); char * outfile = argv[2]; - typedef unsigned char PixelType; - typedef otb::Polygon<> PolygonType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageToEdgePathFilter<ImageType,PolygonType> EdgeExtractionFilterType; - typedef otb::SimplifyPathListFilter<PolygonType> SimplifyPathFilterType; - typedef SimplifyPathFilterType::InputListType PathListType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::PolygonToPolygonRCC8Calculator<PolygonType> CalculatorType; - + typedef unsigned char PixelType; + typedef otb::Polygon<> PolygonType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageToEdgePathFilter<ImageType, PolygonType> EdgeExtractionFilterType; + typedef otb::SimplifyPathListFilter<PolygonType> SimplifyPathFilterType; + typedef SimplifyPathFilterType::InputListType PathListType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::PolygonToPolygonRCC8Calculator<PolygonType> CalculatorType; PolygonType::Pointer path = PolygonType::New(); - PolygonType::ContinuousIndexType a1,a2,a3,a4,a5,a6,a7; + PolygonType::ContinuousIndexType a1, a2, a3, a4, a5, a6, a7; - a1[0]=0; - a1[1]=0; - a2[0]=10; - a2[1]=0; - a3[0]=10; - a3[1]=10; - a4[0]=10; - a4[1]=0; + a1[0] = 0; + a1[1] = 0; + a2[0] = 10; + a2[1] = 0; + a3[0] = 10; + a3[1] = 10; + a4[0] = 10; + a4[1] = 0; - a5[0]=5; - a5[1]=5; + a5[0] = 5; + a5[1] = 5; - a6[0]=5; - a6[1]=0; + a6[0] = 5; + a6[1] = 0; - a7[0]=100; - a7[1]=100; + a7[0] = 100; + a7[1] = 100; path->AddVertex(a1); path->AddVertex(a2); @@ -77,18 +76,18 @@ int otbPolygonToPolygonRCC8Calculator(int argc, char* argv[]) // Reading input images std::ofstream out; - out.open(outfile,std::ios::out); - out<<"Test results from otbPolygonToPolygonRCC8calculator test."<<std::endl; - for (int cpt=1;cpt<=nbImages;++cpt) - { + out.open(outfile, std::ios::out); + out << "Test results from otbPolygonToPolygonRCC8calculator test." << std::endl; + for (int cpt = 1; cpt <= nbImages; ++cpt) + { ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(argv[2+cpt]); + reader->SetFileName(argv[2 + cpt]); EdgeExtractionFilterType::Pointer extraction = EdgeExtractionFilterType::New(); extraction->SetInput(reader->GetOutput()); extraction->SetForegroundValue(255); extraction->Update(); regions->PushBack(extraction->GetOutput()); - } + } SimplifyPathFilterType::Pointer simplifier = SimplifyPathFilterType::New(); simplifier->SetInput(regions); @@ -96,64 +95,63 @@ int otbPolygonToPolygonRCC8Calculator(int argc, char* argv[]) simplifier->Update(); // Declaration - CalculatorType::Pointer calc1,calc2,calc3; + CalculatorType::Pointer calc1, calc2, calc3; // Computing relations for each images couple - unsigned int i =1; + unsigned int i = 1; unsigned int j = 1; - for (IteratorType it1=simplifier->GetOutput()->Begin();it1!=simplifier->GetOutput()->End();++it1) - { - for (IteratorType it2=simplifier->GetOutput()->Begin();it2!=simplifier->GetOutput()->End();++it2) + for (IteratorType it1 = simplifier->GetOutput()->Begin(); it1 != simplifier->GetOutput()->End(); ++it1) { + for (IteratorType it2 = simplifier->GetOutput()->Begin(); it2 != simplifier->GetOutput()->End(); ++it2) + { std::cout << "Test: computing relation " << i << "," << j << std::endl; - calc1=CalculatorType::New(); + calc1 = CalculatorType::New(); calc1->SetPolygon1(it1.Get()); calc1->SetPolygon2(it2.Get()); calc1->Compute(); - out<<calc1->GetValue()<<"\t"; + out << calc1->GetValue() << "\t"; std::cout << "Result without a priori knowledge " << calc1->GetValue() << std::endl; - if (calc1->GetValue()<3 - ||calc1->GetValue()==4 - ||calc1->GetValue()==6) - { - calc2=CalculatorType::New(); + if (calc1->GetValue() < 3 + || calc1->GetValue() == 4 + || calc1->GetValue() == 6) + { + calc2 = CalculatorType::New(); calc2->SetPolygon1(it1.Get()); calc2->SetPolygon2(it2.Get()); calc2->SetLevel1APrioriKnowledge(true); calc2->Compute(); std::cout << "Result with level1 a priori knowledge " << calc2->GetValue() << std::endl; - if (calc2->GetValue()!=calc1->GetValue()) - { + if (calc2->GetValue() != calc1->GetValue()) + { std::cout << "Test failed: Result with level1AprioriKnowledge "; std::cout << "different from result without a priori knowledge" << std::endl; std::cout << calc1->GetValue() << "!=" << calc2->GetValue() << std::endl; return EXIT_FAILURE; + } } - } - if (calc1->GetValue()<4) - { - calc3=CalculatorType::New(); + if (calc1->GetValue() < 4) + { + calc3 = CalculatorType::New(); calc3->SetPolygon1(it1.Get()); calc3->SetPolygon2(it2.Get()); calc3->SetLevel3APrioriKnowledge(true); calc3->Compute(); std::cout << "Result with level3 a priori knowledge " << calc3->GetValue() << std::endl; - if (calc3->GetValue()!=calc1->GetValue()) - { + if (calc3->GetValue() != calc1->GetValue()) + { std::cout << "Test failed: Result with level3AprioriKnowledge "; std::cout << "different from result without a priori knowledge" << std::endl; std::cout << calc1->GetValue() << "!=" << calc3->GetValue() << std::endl; return EXIT_FAILURE; + } } - } j++; - } - j=1; + } + j = 1; i++; - out<<std::endl; - } + out << std::endl; + } out.close(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8CalculatorNew.cxx b/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8CalculatorNew.cxx index d07eaacdac..5267a2e344 100644 --- a/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8CalculatorNew.cxx +++ b/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8CalculatorNew.cxx @@ -21,12 +21,11 @@ int otbPolygonToPolygonRCC8CalculatorNew(int argc, char* argv[]) { - typedef otb::Polygon<> PolygonType; + typedef otb::Polygon<> PolygonType; typedef otb::PolygonToPolygonRCC8Calculator<PolygonType> CalculatorType; //Instantiation CalculatorType::Pointer calc = CalculatorType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbRCC8Edge.cxx b/Testing/Code/SpatialReasoning/otbRCC8Edge.cxx index b14d9b7aee..320c74a9eb 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8Edge.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8Edge.cxx @@ -21,20 +21,19 @@ int otbRCC8Edge(int argc, char* argv[]) { - typedef otb::RCC8Edge RCC8EdgeType; + typedef otb::RCC8Edge RCC8EdgeType; typedef RCC8EdgeType::RCC8ValueType RCC8ValueType; RCC8ValueType value = otb::OTB_RCC8_DC; // Instantiation - RCC8EdgeType::Pointer edge= RCC8EdgeType::New(); + RCC8EdgeType::Pointer edge = RCC8EdgeType::New(); edge->SetValue(value); - - if (edge->GetValue()!=value) - { - std::cout<<"Test failed: edge->GetValue()!=value"<<std::endl; + if (edge->GetValue() != value) + { + std::cout << "Test failed: edge->GetValue()!=value" << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbRCC8EdgeNew.cxx b/Testing/Code/SpatialReasoning/otbRCC8EdgeNew.cxx index 4522f23303..cc2b2f6b48 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8EdgeNew.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8EdgeNew.cxx @@ -24,8 +24,7 @@ int otbRCC8EdgeNew(int argc, char* argv[]) typedef otb::RCC8Edge RCC8EdgeType; // Instantiation - RCC8EdgeType::Pointer rcc8= RCC8EdgeType::New(); - + RCC8EdgeType::Pointer rcc8 = RCC8EdgeType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbRCC8Graph.cxx b/Testing/Code/SpatialReasoning/otbRCC8Graph.cxx index 4850787d60..4e31fc3c8c 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8Graph.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8Graph.cxx @@ -28,43 +28,42 @@ int otbRCC8Graph(int argc, char* argv[]) { const unsigned int nbVertices = 2; - typedef otb::Polygon<> PathType; - typedef PathType::VertexType PointType; - typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; - typedef RCC8GraphType::EdgeType EdgeType; - typedef otb::RCC8VertexIterator<RCC8GraphType> VertexIteratorType; - typedef otb::RCC8EdgeIterator<RCC8GraphType> EdgeIteratorType; - typedef otb::RCC8InEdgeIterator<RCC8GraphType> InEdgeIteratorType; + typedef otb::Polygon<> PathType; + typedef PathType::VertexType PointType; + typedef otb::RCC8VertexBase<PathType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef RCC8GraphType::EdgeType EdgeType; + typedef otb::RCC8VertexIterator<RCC8GraphType> VertexIteratorType; + typedef otb::RCC8EdgeIterator<RCC8GraphType> EdgeIteratorType; + typedef otb::RCC8InEdgeIterator<RCC8GraphType> InEdgeIteratorType; typedef otb::RCC8OutEdgeIterator<RCC8GraphType> OutEdgeIteratorType; // Instantiation RCC8GraphType::Pointer rcc8Graph = RCC8GraphType::New(); // Setting the number of vertices - rcc8Graph->SetNumberOfVertices(nbVertices-1); + rcc8Graph->SetNumberOfVertices(nbVertices - 1); // Call to the build method rcc8Graph->Build(); - - PointType p1,p2,p3,p4,p5,p6; - - p1[0]= 0; - p1[1]= 0; - p2[0]= 10; - p2[1]= 10; - p3[0]= 10; - p3[1]= 0; - p4[0]= 20; - p4[1]= 20; - p5[0]= 20; - p5[1]= 10; - p6[0]= 10; - p6[1]= 20; + PointType p1, p2, p3, p4, p5, p6; + + p1[0] = 0; + p1[1] = 0; + p2[0] = 10; + p2[1] = 10; + p3[0] = 10; + p3[1] = 0; + p4[0] = 20; + p4[1] = 20; + p5[0] = 20; + p5[1] = 10; + p6[0] = 10; + p6[1] = 20; unsigned int vertex1SegLevel = 0; unsigned int vertex2SegLevel = 10; - bool vertex1SegType = true; - bool vertex2SegType = false; + bool vertex1SegType = true; + bool vertex2SegType = false; PathType::Pointer path1 = PathType::New(); path1->AddVertex(p1); @@ -86,74 +85,70 @@ int otbRCC8Graph(int argc, char* argv[]) vertex2->SetSegmentationType(vertex2SegType); vertex2->SetPath(path2); + rcc8Graph->SetVertex(0, vertex1); + rcc8Graph->SetVertex(1, vertex2); - rcc8Graph->SetVertex(0,vertex1); - rcc8Graph->SetVertex(1,vertex2); - - otbControlConditionTestMacro(rcc8Graph->GetNumberOfVertices()!=nbVertices, + otbControlConditionTestMacro(rcc8Graph->GetNumberOfVertices() != nbVertices, "rcc8Graph->GetNumberOfVertices()!=nbVertices"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetSegmentationLevel()!=vertex1SegLevel, + otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetSegmentationLevel() != vertex1SegLevel, "rcc8Graph->GetVertex(0)->GetSegmentationLevel()!=vertex1SegLevel"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetSegmentationType()!=vertex1SegType, + otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetSegmentationType() != vertex1SegType, "rcc8Graph->GetVertex(0)->GetSegmentationType()!=vertex1SegType"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(0)!=p1, + otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(0) != p1, "rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(0)!=p1"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(1)!=p2, + otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(1) != p2, "rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(1)!=p2"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(2)!=p3, + otbControlConditionTestMacro(rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(2) != p3, "rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(2)!=p3"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetSegmentationLevel()!=vertex2SegLevel, + otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetSegmentationLevel() != vertex2SegLevel, "rcc8Graph->GetVertex(1)->GetSegmentationLevel()!=vertex2SegLevel"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetSegmentationType()!=vertex2SegType, + otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetSegmentationType() != vertex2SegType, "rcc8Graph->GetVertex(1)->GetObjectLabelInImgage()!=vertex2SegType"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(0)!=p4, + otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(0) != p4, "rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(0)!=p4"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(1)!=p5, + otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(1) != p5, "rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(1)!=p5"); - otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(2)!=p6, + otbControlConditionTestMacro(rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(2) != p6, "rcc8Graph->GetVertex(1)->GetPath()->GetVertexList()->GetElement(2)!=p6"); - VertexIteratorType v(rcc8Graph); v.GoToBegin(); - otbControlConditionTestMacro(v.Get()->GetSegmentationLevel()!=vertex1SegLevel, + otbControlConditionTestMacro(v.Get()->GetSegmentationLevel() != vertex1SegLevel, "v.Get()->GetSegmentationLevel()!=vertex1SegLevel"); - otbControlConditionTestMacro(v.Get()->GetSegmentationType()!=vertex1SegType, + otbControlConditionTestMacro(v.Get()->GetSegmentationType() != vertex1SegType, "v.Get()->GetSegmentationType()!=vertex1SegType"); - otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(0)!=p1, + otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(0) != p1, "v.Get()->GetPath()->GetVertexList()->GetElement(0)!=p1"); - otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(1)!=p2, + otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(1) != p2, "v.Get()->GetPath()->GetVertexList()->GetElement(1)!=p2"); - otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(2)!=p3, + otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(2) != p3, "v.Get()->GetPath()->GetVertexList()->GetElement(2)!=p3"); ++v; - otbControlConditionTestMacro(v.Get()->GetSegmentationLevel()!=vertex2SegLevel, + otbControlConditionTestMacro(v.Get()->GetSegmentationLevel() != vertex2SegLevel, "v.Get()->GetSegmentationLevel()!=vertex2SegLevel"); - otbControlConditionTestMacro(v.Get()->GetSegmentationType()!=vertex2SegType, + otbControlConditionTestMacro(v.Get()->GetSegmentationType() != vertex2SegType, "v.Get()->GetObjectLabelInImgage()!=vertex2SegType"); - otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(0)!=p4, + otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(0) != p4, "rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(0)!=p4"); - otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(1)!=p5, + otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(1) != p5, "rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(1)!=p5"); - otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(2)!=p6, + otbControlConditionTestMacro(v.Get()->GetPath()->GetVertexList()->GetElement(2) != p6, "rcc8Graph->GetVertex(0)->GetPath()->GetVertexList()->GetElement(2)!=p6"); - // Testing the edge iterator - rcc8Graph->AddEdge(0,1,otb::OTB_RCC8_NTPPI); + rcc8Graph->AddEdge(0, 1, otb::OTB_RCC8_NTPPI); - otbControlConditionTestMacro(rcc8Graph->GetNumberOfEdges()!=1, + otbControlConditionTestMacro(rcc8Graph->GetNumberOfEdges() != 1, "rcc8Graph->GetNumberOfEdges()!=1"); EdgeIteratorType e(rcc8Graph); e.GoToBegin(); - otbControlConditionTestMacro(e.GetValue()!=otb::OTB_RCC8_NTPPI, + otbControlConditionTestMacro(e.GetValue() != otb::OTB_RCC8_NTPPI, "e.GetValue()!=otb::OTB_RCC8_NTPPI"); - otbControlConditionTestMacro(e.GetSourceIndex()!=0, + otbControlConditionTestMacro(e.GetSourceIndex() != 0, "e.GetSourceIndex()!=0"); - otbControlConditionTestMacro(e.GetTargetIndex()!=1, + otbControlConditionTestMacro(e.GetTargetIndex() != 1, "e.GetTargetIndex()!=1"); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbRCC8GraphFileReader.cxx b/Testing/Code/SpatialReasoning/otbRCC8GraphFileReader.cxx index d316d2f6cc..15b9786b60 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8GraphFileReader.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8GraphFileReader.cxx @@ -24,16 +24,15 @@ #include "otbMacro.h" #include "otbPolygon.h" - int otbRCC8GraphFileReader(int argc, char* argv[]) { char * inputFilename = argv[1]; - typedef otb::Polygon<> PathType; - typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::Polygon<> PathType; + typedef otb::RCC8VertexBase<PathType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; typedef otb::RCC8GraphFileReader<RCC8GraphType> RCC8GraphFileReaderType; - typedef otb::RCC8VertexIterator<RCC8GraphType> VertexIteratorType; - typedef otb::RCC8EdgeIterator<RCC8GraphType> EdgeIteratorType; + typedef otb::RCC8VertexIterator<RCC8GraphType> VertexIteratorType; + typedef otb::RCC8EdgeIterator<RCC8GraphType> EdgeIteratorType; // Instantiation RCC8GraphFileReaderType::Pointer rcc8GraphReader = RCC8GraphFileReaderType::New(); @@ -44,77 +43,75 @@ int otbRCC8GraphFileReader(int argc, char* argv[]) // Getting the output graph RCC8GraphType::Pointer graph = rcc8GraphReader->GetOutput(); - // Checking vertices VertexIteratorType vIt(graph); - unsigned int count = 0; + unsigned int count = 0; - otbControlConditionTestMacro(graph->GetNumberOfVertices()!=4, + otbControlConditionTestMacro(graph->GetNumberOfVertices() != 4, "graph->GetNumberOfVertices()!=4"); - otbControlConditionTestMacro(graph->GetNumberOfEdges()!=6, + otbControlConditionTestMacro(graph->GetNumberOfEdges() != 6, "graph->GetNumberOfEdges()!=6"); // Checking edges EdgeIteratorType eIt(graph); - count=0; - for (eIt.GoToBegin();!eIt.IsAtEnd();++eIt,++count) - { - switch (count) + count = 0; + for (eIt.GoToBegin(); !eIt.IsAtEnd(); ++eIt, ++count) { + switch (count) + { case 0: - otbControlConditionTestMacro(eIt.GetValue()!=otb::OTB_RCC8_EC, + otbControlConditionTestMacro(eIt.GetValue() != otb::OTB_RCC8_EC, "eIt.GetValue()!=otb::OTB_RCC8_EC"); - otbControlConditionTestMacro(eIt.GetSourceIndex()!=0, + otbControlConditionTestMacro(eIt.GetSourceIndex() != 0, "eIt.GetSourceIndex()!=0"); - otbControlConditionTestMacro(eIt.GetTargetIndex()!=1, + otbControlConditionTestMacro(eIt.GetTargetIndex() != 1, "eIt.GetTargetIndex()!=1"); break; case 1: - otbControlConditionTestMacro(eIt.GetValue()!=otb::OTB_RCC8_PO, + otbControlConditionTestMacro(eIt.GetValue() != otb::OTB_RCC8_PO, "eIt.GetValue()!=otb::OTB_RCC8_PO"); - otbControlConditionTestMacro(eIt.GetSourceIndex()!=1, + otbControlConditionTestMacro(eIt.GetSourceIndex() != 1, "eIt.GetSourceIndex()!=1"); - otbControlConditionTestMacro(eIt.GetTargetIndex()!=2, + otbControlConditionTestMacro(eIt.GetTargetIndex() != 2, "eIt.GetTargetIndex()!=2"); break; case 2: - otbControlConditionTestMacro(eIt.GetValue()!=otb::OTB_RCC8_TPP, + otbControlConditionTestMacro(eIt.GetValue() != otb::OTB_RCC8_TPP, "eIt.GetValue()!=otb::OTB_RCC8_TPP"); - otbControlConditionTestMacro(eIt.GetSourceIndex()!=2, + otbControlConditionTestMacro(eIt.GetSourceIndex() != 2, "eIt.GetSourceIndex()!=2"); - otbControlConditionTestMacro(eIt.GetTargetIndex()!=3, + otbControlConditionTestMacro(eIt.GetTargetIndex() != 3, "eIt.GetTargetIndex()!=3"); break; case 3: - otbControlConditionTestMacro(eIt.GetValue()!=otb::OTB_RCC8_TPPI, + otbControlConditionTestMacro(eIt.GetValue() != otb::OTB_RCC8_TPPI, "eIt.GetValue()!=otb::OTB_RCC8_TPPI"); - otbControlConditionTestMacro(eIt.GetSourceIndex()!=0, + otbControlConditionTestMacro(eIt.GetSourceIndex() != 0, "eIt.GetSourceIndex()!=0"); - otbControlConditionTestMacro(eIt.GetTargetIndex()!=2, + otbControlConditionTestMacro(eIt.GetTargetIndex() != 2, "eIt.GetTargetIndex()!=2"); break; case 4: - otbControlConditionTestMacro(eIt.GetValue()!=otb::OTB_RCC8_NTPP, + otbControlConditionTestMacro(eIt.GetValue() != otb::OTB_RCC8_NTPP, "eIt.GetValue()!=otb::OTB_RCC8_NTPP"); - otbControlConditionTestMacro(eIt.GetSourceIndex()!=1, + otbControlConditionTestMacro(eIt.GetSourceIndex() != 1, "eIt.GetSourceIndex()!=1"); - otbControlConditionTestMacro(eIt.GetTargetIndex()!=3, + otbControlConditionTestMacro(eIt.GetTargetIndex() != 3, "eIt.GetTargetIndex()!=3"); break; case 5: - otbControlConditionTestMacro(eIt.GetValue()!=otb::OTB_RCC8_NTPPI, + otbControlConditionTestMacro(eIt.GetValue() != otb::OTB_RCC8_NTPPI, "eIt.GetValue()!=otb::OTB_RCC8_NTPPI"); - otbControlConditionTestMacro(eIt.GetSourceIndex()!=0, + otbControlConditionTestMacro(eIt.GetSourceIndex() != 0, "eIt.GetSourceIndex()!=0"); - otbControlConditionTestMacro(eIt.GetTargetIndex()!=3, + otbControlConditionTestMacro(eIt.GetTargetIndex() != 3, "eIt.GetTargetIndex()!=3"); break; default: - otbControlConditionTestMacro(true,"Error in graph reading."); + otbControlConditionTestMacro(true, "Error in graph reading."); break; + } } - } - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbRCC8GraphFileReaderNew.cxx b/Testing/Code/SpatialReasoning/otbRCC8GraphFileReaderNew.cxx index f9a3616469..1ae6a1118c 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8GraphFileReaderNew.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8GraphFileReaderNew.cxx @@ -23,9 +23,9 @@ int otbRCC8GraphFileReaderNew(int argc, char* argv[]) { - typedef otb::Polygon<> PathType; - typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::Polygon<> PathType; + typedef otb::RCC8VertexBase<PathType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; typedef otb::RCC8GraphFileReader<RCC8GraphType> RCC8GraphFileReaderType; // Instantiation diff --git a/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriter.cxx b/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriter.cxx index 081018729c..8b0f5d4e47 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriter.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriter.cxx @@ -25,9 +25,9 @@ int otbRCC8GraphFileWriter(int argc, char* argv[]) { const char * outputFile = argv[1]; - typedef otb::Polygon<> PathType; - typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::Polygon<> PathType; + typedef otb::RCC8VertexBase<PathType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; typedef otb::RCC8GraphFileWriter<RCC8GraphType> RCC8GraphFileWriterType; // Graph instantiation @@ -39,62 +39,60 @@ int otbRCC8GraphFileWriter(int argc, char* argv[]) PathType::Pointer path = PathType::New(); path->Initialize(); - PathType::ContinuousIndexType p1,p2,p3; + PathType::ContinuousIndexType p1, p2, p3; - p1[0]=0; - p1[1]=0; + p1[0] = 0; + p1[1] = 0; - p2[0]=10; - p2[1]=10; + p2[0] = 10; + p2[1] = 10; - p3[0]=-5; - p3[1]=2; + p3[0] = -5; + p3[1] = 2; path->AddVertex(p1); path->AddVertex(p2); path->AddVertex(p3); - VertexType::Pointer vertex1, vertex2, vertex3, vertex4; vertex1 = VertexType::New(); vertex1->SetSegmentationLevel(0); vertex1->SetSegmentationType(0); vertex1->SetPath(path); - rcc8Graph->SetVertex(0,vertex1); + rcc8Graph->SetVertex(0, vertex1); vertex2 = VertexType::New(); vertex2->SetSegmentationLevel(1); vertex2->SetSegmentationType(1); vertex2->SetPath(path); - rcc8Graph->SetVertex(1,vertex2); + rcc8Graph->SetVertex(1, vertex2); vertex3 = VertexType::New(); vertex3->SetSegmentationLevel(2); vertex3->SetSegmentationType(0); vertex3->SetPath(path); - rcc8Graph->SetVertex(2,vertex3); + rcc8Graph->SetVertex(2, vertex3); vertex4 = VertexType::New(); vertex4->SetSegmentationLevel(3); vertex4->SetSegmentationType(0); vertex4->SetPath(path); - rcc8Graph->SetVertex(3,vertex4); + rcc8Graph->SetVertex(3, vertex4); // Edge filling - rcc8Graph->AddEdge(0,1,otb::OTB_RCC8_EC); - rcc8Graph->AddEdge(1,2,otb::OTB_RCC8_PO); - rcc8Graph->AddEdge(2,3,otb::OTB_RCC8_TPP); - rcc8Graph->AddEdge(0,2,otb::OTB_RCC8_TPPI); - rcc8Graph->AddEdge(1,3,otb::OTB_RCC8_NTPP); - rcc8Graph->AddEdge(0,3,otb::OTB_RCC8_NTPPI); + rcc8Graph->AddEdge(0, 1, otb::OTB_RCC8_EC); + rcc8Graph->AddEdge(1, 2, otb::OTB_RCC8_PO); + rcc8Graph->AddEdge(2, 3, otb::OTB_RCC8_TPP); + rcc8Graph->AddEdge(0, 2, otb::OTB_RCC8_TPPI); + rcc8Graph->AddEdge(1, 3, otb::OTB_RCC8_NTPP); + rcc8Graph->AddEdge(0, 3, otb::OTB_RCC8_NTPPI); // Instantiation RCC8GraphFileWriterType::Pointer rcc8GraphWriter - = RCC8GraphFileWriterType::New(); + = RCC8GraphFileWriterType::New(); rcc8GraphWriter->SetFileName(outputFile); rcc8GraphWriter->SetInput(rcc8Graph); rcc8GraphWriter->Update(); return EXIT_SUCCESS; } - diff --git a/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriterNew.cxx b/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriterNew.cxx index a6e53feccb..7c7a4173e8 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriterNew.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriterNew.cxx @@ -23,9 +23,9 @@ int otbRCC8GraphFileWriterNew(int argc, char* argv[]) { - typedef otb::Polygon<> PathType; - typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::Polygon<> PathType; + typedef otb::RCC8VertexBase<PathType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; typedef otb::RCC8GraphFileWriter<RCC8GraphType> RCC8GraphFileWriterType; // Instantiation @@ -33,4 +33,3 @@ int otbRCC8GraphFileWriterNew(int argc, char* argv[]) return EXIT_SUCCESS; } - diff --git a/Testing/Code/SpatialReasoning/otbRCC8GraphIOEndToEnd.cxx b/Testing/Code/SpatialReasoning/otbRCC8GraphIOEndToEnd.cxx index 9024cb81dd..4c8078eb6e 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8GraphIOEndToEnd.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8GraphIOEndToEnd.cxx @@ -26,9 +26,9 @@ int otbRCC8GraphIOEndToEnd(int argc, char* argv[]) { char * inputFilename = argv[1]; char * outputFilename = argv[2]; - typedef otb::Polygon<> PathType; - typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::Polygon<> PathType; + typedef otb::RCC8VertexBase<PathType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; typedef otb::RCC8GraphFileReader<RCC8GraphType> RCC8GraphFileReaderType; typedef otb::RCC8GraphFileWriter<RCC8GraphType> RCC8GraphFileWriterType; diff --git a/Testing/Code/SpatialReasoning/otbRCC8GraphNew.cxx b/Testing/Code/SpatialReasoning/otbRCC8GraphNew.cxx index 97eded217a..32f6b9929d 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8GraphNew.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8GraphNew.cxx @@ -22,9 +22,9 @@ int otbRCC8GraphNew(int argc, char* argv[]) { - typedef otb::Polygon<> PathType; + typedef otb::Polygon<> PathType; typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; // Instantiation RCC8GraphType::Pointer rcc8Graph = RCC8GraphType::New(); diff --git a/Testing/Code/SpatialReasoning/otbRCC8GraphSourceNew.cxx b/Testing/Code/SpatialReasoning/otbRCC8GraphSourceNew.cxx index aae587ede0..e5c16bb957 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8GraphSourceNew.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8GraphSourceNew.cxx @@ -23,9 +23,9 @@ int otbRCC8GraphSourceNew(int argc, char* argv[]) { - typedef otb::Polygon<> PathType; - typedef otb::RCC8VertexBase<PathType> VertexType; - typedef otb::RCC8Graph<VertexType> RCC8GraphType; + typedef otb::Polygon<> PathType; + typedef otb::RCC8VertexBase<PathType> VertexType; + typedef otb::RCC8Graph<VertexType> RCC8GraphType; typedef otb::RCC8GraphSource<RCC8GraphType> RCC8GraphSourceType; // Instantiation diff --git a/Testing/Code/SpatialReasoning/otbRCC8VertexBase.cxx b/Testing/Code/SpatialReasoning/otbRCC8VertexBase.cxx index f985ae8829..0f20a8fa0b 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8VertexBase.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8VertexBase.cxx @@ -24,25 +24,25 @@ int otbRCC8VertexBase(int argc, char* argv[]) { typedef otb::Polygon<> PathType; unsigned int imageLevel = atoi(argv[1]); - bool imageType = atoi(argv[2]); - typedef otb::RCC8VertexBase<PathType> RCC8VertexType; + bool imageType = atoi(argv[2]); + typedef otb::RCC8VertexBase<PathType> RCC8VertexType; typedef RCC8VertexType::AttributesMapType AttributesMapType; // Instantiation - RCC8VertexType::Pointer vertex1= RCC8VertexType::New(); + RCC8VertexType::Pointer vertex1 = RCC8VertexType::New(); PathType::Pointer path = PathType::New(); path->Initialize(); - PathType::ContinuousIndexType p1,p2,p3; + PathType::ContinuousIndexType p1, p2, p3; - p1[0]=0; - p1[1]=0; + p1[0] = 0; + p1[1] = 0; - p2[0]=10; - p2[1]=10; + p2[0] = 10; + p2[1] = 10; - p3[0]=-5; - p3[1]=2; + p3[0] = -5; + p3[1] = 2; path->AddVertex(p1); path->AddVertex(p2); @@ -53,53 +53,52 @@ int otbRCC8VertexBase(int argc, char* argv[]) vertex1->SetSegmentationType(imageType); vertex1->SetPath(path); - otbControlConditionTestMacro(vertex1->GetSegmentationLevel()!=imageLevel, + otbControlConditionTestMacro(vertex1->GetSegmentationLevel() != imageLevel, "Test failed: vertex1->GetSegmentationLevel()!=imageLevel"); - otbControlConditionTestMacro( vertex1->GetSegmentationType()!=imageType, - "Test failed: vertex1->GetSegmentationType()!=imageType"); + otbControlConditionTestMacro(vertex1->GetSegmentationType() != imageType, + "Test failed: vertex1->GetSegmentationType()!=imageType"); - otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(0)!=p1, + otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(0) != p1, "Test failed:vertex1->GetPath()->GetVertexList()->GetElement(0)!=p1"); - otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(1)!=p2, + otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(1) != p2, "Test failed:vertex1->GetPath()->GetVertexList()->GetElement(1)!=p2"); - otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(2)!=p3, + otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(2) != p3, "Test failed:vertex1->GetPath()->GetVertexList()->GetElement(2)!=p3"); // attributes vector set test AttributesMapType attr1 = vertex1->GetAttributesMap(); - otbControlConditionTestMacro( attr1["SegmentationLevel"].compare(std::string(argv[1]))!=0, - "Test failed: vertex1->GetAttributesMap()[\"SegmentationLevel\"]!=std::string(argv[1])"); - otbControlConditionTestMacro(atoi(attr1["SegmentationType"].c_str())!=static_cast<int>(imageType), + otbControlConditionTestMacro(attr1["SegmentationLevel"].compare(std::string(argv[1])) != 0, + "Test failed: vertex1->GetAttributesMap()[\"SegmentationLevel\"]!=std::string(argv[1])"); + otbControlConditionTestMacro(atoi(attr1["SegmentationType"].c_str()) != static_cast<int>(imageType), "Test failed:atoi(attr1[\"SegmentationType\"].c_str())!=imageType "); - otbControlConditionTestMacro( atof(attr1["P0x"].c_str())!=p1[0], - "Test failed: atof(attr1[\"P0x\"].c_str())!=p1[0]"); - otbControlConditionTestMacro( atof(attr1["P0y"].c_str())!=p1[1], - "Test failed: atof(attr1[\"P0y\"].c_str())!=p1[1]"); - otbControlConditionTestMacro( atof(attr1["P1x"].c_str())!=p2[0], - "Test failed: atof(attr1[\"P1x\"].c_str())!=p2[0]"); - otbControlConditionTestMacro( atof(attr1["P1y"].c_str())!=p2[1], - "Test failed: atof(attr1[\"P1y\"].c_str())!=p2[1]"); - otbControlConditionTestMacro( atof(attr1["P2x"].c_str())!=p3[0], - "Test failed: atof(attr1[\"P2x\"].c_str())!=p3[0]"); - otbControlConditionTestMacro(atof( attr1["P2y"].c_str())!=p3[1], + otbControlConditionTestMacro(atof(attr1["P0x"].c_str()) != p1[0], + "Test failed: atof(attr1[\"P0x\"].c_str())!=p1[0]"); + otbControlConditionTestMacro(atof(attr1["P0y"].c_str()) != p1[1], + "Test failed: atof(attr1[\"P0y\"].c_str())!=p1[1]"); + otbControlConditionTestMacro(atof(attr1["P1x"].c_str()) != p2[0], + "Test failed: atof(attr1[\"P1x\"].c_str())!=p2[0]"); + otbControlConditionTestMacro(atof(attr1["P1y"].c_str()) != p2[1], + "Test failed: atof(attr1[\"P1y\"].c_str())!=p2[1]"); + otbControlConditionTestMacro(atof(attr1["P2x"].c_str()) != p3[0], + "Test failed: atof(attr1[\"P2x\"].c_str())!=p3[0]"); + otbControlConditionTestMacro(atof(attr1["P2y"].c_str()) != p3[1], "Test failed: atof( attr1[\"P2y\"].c_str())!=p3[1]"); // attributes vector get test RCC8VertexType::Pointer vertex2 = RCC8VertexType::New(); vertex2->SetAttributesMap(attr1); - otbControlConditionTestMacro(vertex1->GetSegmentationLevel()!=vertex2->GetSegmentationLevel(), + otbControlConditionTestMacro(vertex1->GetSegmentationLevel() != vertex2->GetSegmentationLevel(), "Test failed: vertex1->GetSegmentationLevel()!=vertex2->GetSegmentationLevel()"); - otbControlConditionTestMacro(vertex1->GetSegmentationType()!=vertex2->GetSegmentationType(), + otbControlConditionTestMacro(vertex1->GetSegmentationType() != vertex2->GetSegmentationType(), "Test failed: vertex1->GetSegmentationType()!=vertex2->GetSegmentationType()"); - otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(0)!=p1, + otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(0) != p1, "Test failed:vertex2->GetPath()->GetVertexList()->GetElement(0)!=p1"); - otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(1)!=p2, + otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(1) != p2, "Test failed:vertex2->GetPath()->GetVertexList()->GetElement(1)!=p2"); - otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(2)!=p3, + otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(2) != p3, "Test failed:vertex2->GetPath()->GetVertexList()->GetElement(2)!=p3"); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbRCC8VertexBaseNew.cxx b/Testing/Code/SpatialReasoning/otbRCC8VertexBaseNew.cxx index 8c86d07eb8..2fa4a21c4a 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8VertexBaseNew.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8VertexBaseNew.cxx @@ -21,11 +21,11 @@ int otbRCC8VertexBaseNew(int argc, char* argv[]) { - typedef otb::Polygon<> PathType; + typedef otb::Polygon<> PathType; typedef otb::RCC8VertexBase<PathType> RCC8VertexType; // Instantiation - RCC8VertexType::Pointer rcc8Vertex= RCC8VertexType::New(); + RCC8VertexType::Pointer rcc8Vertex = RCC8VertexType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacity.cxx b/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacity.cxx index c0dd9c6a0a..700e60a494 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacity.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacity.cxx @@ -20,34 +20,33 @@ #include "otbMacro.h" #include "otbPolygon.h" - int otbRCC8VertexWithCompacity(int argc, char* argv[]) { typedef otb::Polygon<> PathType; - typedef double PrecisionType; + typedef double PrecisionType; - unsigned int imageLevel = atoi(argv[1]); - bool imageType = atoi(argv[2]); + unsigned int imageLevel = atoi(argv[1]); + bool imageType = atoi(argv[2]); PrecisionType compacity = atof(argv[3]); - typedef otb::RCC8VertexWithCompacity<PathType,PrecisionType> RCC8VertexType; - typedef RCC8VertexType::AttributesMapType AttributesMapType; + typedef otb::RCC8VertexWithCompacity<PathType, PrecisionType> RCC8VertexType; + typedef RCC8VertexType::AttributesMapType AttributesMapType; // Instantiation - RCC8VertexType::Pointer vertex1= RCC8VertexType::New(); + RCC8VertexType::Pointer vertex1 = RCC8VertexType::New(); PathType::Pointer path = PathType::New(); path->Initialize(); - PathType::ContinuousIndexType p1,p2,p3; + PathType::ContinuousIndexType p1, p2, p3; - p1[0]=0; - p1[1]=0; + p1[0] = 0; + p1[1] = 0; - p2[0]=10; - p2[1]=10; + p2[0] = 10; + p2[1] = 10; - p3[0]=-5; - p3[1]=2; + p3[0] = -5; + p3[1] = 2; path->AddVertex(p1); path->AddVertex(p2); @@ -59,67 +58,65 @@ int otbRCC8VertexWithCompacity(int argc, char* argv[]) vertex1->SetPath(path); vertex1->SetCompacity(compacity); - otbControlConditionTestMacro(vertex1->GetSegmentationLevel()!=imageLevel, + otbControlConditionTestMacro(vertex1->GetSegmentationLevel() != imageLevel, "Test failed: vertex1->GetSegmentationLevel()!=imageLevel"); - otbControlConditionTestMacro( vertex1->GetSegmentationType()!=imageType, - "Test failed: vertex1->GetSegmentationType()!=imageType"); + otbControlConditionTestMacro(vertex1->GetSegmentationType() != imageType, + "Test failed: vertex1->GetSegmentationType()!=imageType"); - otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(0)!=p1, + otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(0) != p1, "Test failed:vertex1->GetPath()->GetVertexList()->GetElement(0)!=p1"); - otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(1)!=p2, + otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(1) != p2, "Test failed:vertex1->GetPath()->GetVertexList()->GetElement(1)!=p2"); - otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(2)!=p3, + otbControlConditionTestMacro(vertex1->GetPath()->GetVertexList()->GetElement(2) != p3, "Test failed:vertex1->GetPath()->GetVertexList()->GetElement(2)!=p3"); - otbControlConditionTestMacro(vertex1->GetCompacity()!=compacity, + otbControlConditionTestMacro(vertex1->GetCompacity() != compacity, "Test failed: vertex1->GetSegmentationImageIndex()!=imageIndex"); // attributes vector set test AttributesMapType attr1 = vertex1->GetAttributesMap(); itk::OStringStream oss; - oss<<p1[0]; - otbControlConditionTestMacro( attr1["P0x"].compare(oss.str())!=0, - "Test failed:attr1[\"P0x\"].compare(std::string(p1[0]))!=0"); + oss << p1[0]; + otbControlConditionTestMacro(attr1["P0x"].compare(oss.str()) != 0, + "Test failed:attr1[\"P0x\"].compare(std::string(p1[0]))!=0"); oss.str(""); - oss<<p1[1]; - otbControlConditionTestMacro( attr1["P0y"].compare(oss.str())!=0, - "Test failed:attr1[\"P0y\"].compare(std::string(p1[1]))!=0"); + oss << p1[1]; + otbControlConditionTestMacro(attr1["P0y"].compare(oss.str()) != 0, + "Test failed:attr1[\"P0y\"].compare(std::string(p1[1]))!=0"); oss.str(""); - oss<<p2[0]; - otbControlConditionTestMacro( attr1["P1x"].compare(oss.str())!=0, - "Test failed:attr1[\"P1x\"].compare(std::string(p2[0]))!=0"); + oss << p2[0]; + otbControlConditionTestMacro(attr1["P1x"].compare(oss.str()) != 0, + "Test failed:attr1[\"P1x\"].compare(std::string(p2[0]))!=0"); oss.str(""); - oss<<p2[1]; - otbControlConditionTestMacro( attr1["P1y"].compare(oss.str())!=0, - "Test failed:attr1[\"P1y\"].compare(std::string(p2[1]))!=0"); + oss << p2[1]; + otbControlConditionTestMacro(attr1["P1y"].compare(oss.str()) != 0, + "Test failed:attr1[\"P1y\"].compare(std::string(p2[1]))!=0"); oss.str(""); - oss<<p3[0]; - otbControlConditionTestMacro( attr1["P2x"].compare(oss.str())!=0, - "Test failed:attr1[\"P2x\"].compare(std::string(p3[0]))!=0"); + oss << p3[0]; + otbControlConditionTestMacro(attr1["P2x"].compare(oss.str()) != 0, + "Test failed:attr1[\"P2x\"].compare(std::string(p3[0]))!=0"); oss.str(""); - oss<<p3[1]; - otbControlConditionTestMacro( attr1["P2y"].compare(oss.str())!=0, - "Test failed:attr1[\"P2y\"].compare(std::string(p3[1]))!=0"); - + oss << p3[1]; + otbControlConditionTestMacro(attr1["P2y"].compare(oss.str()) != 0, + "Test failed:attr1[\"P2y\"].compare(std::string(p3[1]))!=0"); - otbControlConditionTestMacro(attr1["Compacity"].compare(std::string(argv[3]))!=0, + otbControlConditionTestMacro(attr1["Compacity"].compare(std::string(argv[3])) != 0, "Test failed: vertex1->GetAttributesMap()[\"Compacity\"]!=std::string(argv[2])"); // attributes vector get test RCC8VertexType::Pointer vertex2 = RCC8VertexType::New(); vertex2->SetAttributesMap(attr1); - otbControlConditionTestMacro(vertex1->GetSegmentationLevel()!=vertex2->GetSegmentationLevel(), + otbControlConditionTestMacro(vertex1->GetSegmentationLevel() != vertex2->GetSegmentationLevel(), "Test failed: vertex1->GetSegmentationLevel()!=vertex2->GetSegmentationLevel()"); - otbControlConditionTestMacro(vertex1->GetSegmentationType()!=vertex2->GetSegmentationType(), + otbControlConditionTestMacro(vertex1->GetSegmentationType() != vertex2->GetSegmentationType(), "Test failed: vertex1->GetSegmentationType()!=vertex2->GetSegmentationType()"); - otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(0)!=p1, + otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(0) != p1, "Test failed:vertex2->GetPath()->GetVertexList()->GetElement(0)!=p1"); - otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(1)!=p2, + otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(1) != p2, "Test failed:vertex2->GetPath()->GetVertexList()->GetElement(1)!=p2"); - otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(2)!=p3, + otbControlConditionTestMacro(vertex2->GetPath()->GetVertexList()->GetElement(2) != p3, "Test failed:vertex2->GetPath()->GetVertexList()->GetElement(2)!=p3"); - otbControlConditionTestMacro(vertex1->GetCompacity()!=vertex2->GetCompacity(), + otbControlConditionTestMacro(vertex1->GetCompacity() != vertex2->GetCompacity(), "Test failed: vertex1->GetCompacity()!=vertex2->GetCompacity()"); - return EXIT_SUCCESS; } diff --git a/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacityNew.cxx b/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacityNew.cxx index d31b20ef85..58faa62b46 100644 --- a/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacityNew.cxx +++ b/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacityNew.cxx @@ -21,12 +21,12 @@ int otbRCC8VertexWithCompacityNew(int argc, char* argv[]) { - typedef otb::Polygon<> PathType; - typedef float PrecisionType; - typedef otb::RCC8VertexWithCompacity<PathType,PrecisionType> RCC8VertexType; + typedef otb::Polygon<> PathType; + typedef float PrecisionType; + typedef otb::RCC8VertexWithCompacity<PathType, PrecisionType> RCC8VertexType; // Instantiation - RCC8VertexType::Pointer rcc8Vertex= RCC8VertexType::New(); + RCC8VertexType::Pointer rcc8Vertex = RCC8VertexType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/TestSystem/otbCompareAsciiTests.cxx b/Testing/Code/TestSystem/otbCompareAsciiTests.cxx index bb083e75ad..e0d897f080 100644 --- a/Testing/Code/TestSystem/otbCompareAsciiTests.cxx +++ b/Testing/Code/TestSystem/otbCompareAsciiTests.cxx @@ -23,12 +23,12 @@ int otbCompareAsciiTests(int argc, char * argv[]) { - if ( argc != 3 ) - { + if (argc != 3) + { std::cerr << "Usage: " << argv[0]; std::cerr << " referenceFile testFile" << std::endl; return EXIT_FAILURE; - } + } std::ofstream fileRef; fileRef.open(argv[1]); @@ -37,7 +37,6 @@ int otbCompareAsciiTests(int argc, char * argv[]) fileRef << "3\n"; fileRef.close(); - std::ofstream fileTest; fileTest.open(argv[2]); fileTest << "1\n"; diff --git a/Testing/Code/TestSystem/otbCompareAsciiTests2.cxx b/Testing/Code/TestSystem/otbCompareAsciiTests2.cxx index 59c15b2200..b298ac9c97 100644 --- a/Testing/Code/TestSystem/otbCompareAsciiTests2.cxx +++ b/Testing/Code/TestSystem/otbCompareAsciiTests2.cxx @@ -23,12 +23,12 @@ int otbCompareAsciiTests2(int argc, char * argv[]) { - if ( argc != 3 ) - { + if (argc != 3) + { std::cerr << "Usage: " << argv[0]; std::cerr << " referenceFile testFile" << std::endl; return EXIT_FAILURE; - } + } std::ofstream fileRef; fileRef.open(argv[1]); @@ -36,7 +36,6 @@ int otbCompareAsciiTests2(int argc, char * argv[]) fileRef << "2\n"; fileRef.close(); - std::ofstream fileTest; fileTest.open(argv[2]); fileTest << "1\n"; diff --git a/Testing/Code/TestSystem/otbCompareAsciiTests3.cxx b/Testing/Code/TestSystem/otbCompareAsciiTests3.cxx index 441eddbc28..358be598b6 100644 --- a/Testing/Code/TestSystem/otbCompareAsciiTests3.cxx +++ b/Testing/Code/TestSystem/otbCompareAsciiTests3.cxx @@ -23,12 +23,12 @@ int otbCompareAsciiTests3(int argc, char * argv[]) { - if ( argc != 3 ) - { + if (argc != 3) + { std::cerr << "Usage: " << argv[0]; std::cerr << " referenceFile testFile" << std::endl; return EXIT_FAILURE; - } + } std::ofstream fileRef; fileRef.open(argv[1]); @@ -38,7 +38,6 @@ int otbCompareAsciiTests3(int argc, char * argv[]) fileRef << "2\n"; fileRef.close(); - std::ofstream fileTest; fileTest.open(argv[2]); fileTest << "2\n"; diff --git a/Testing/Code/TestSystem/otbCompareAsciiTests4.cxx b/Testing/Code/TestSystem/otbCompareAsciiTests4.cxx index 3d412ded6d..4b27890a3c 100644 --- a/Testing/Code/TestSystem/otbCompareAsciiTests4.cxx +++ b/Testing/Code/TestSystem/otbCompareAsciiTests4.cxx @@ -23,12 +23,12 @@ int otbCompareAsciiTests4(int argc, char * argv[]) { - if ( argc != 3 ) - { + if (argc != 3) + { std::cerr << "Usage: " << argv[0]; std::cerr << " referenceFile testFile" << std::endl; return EXIT_FAILURE; - } + } std::ofstream fileRef; fileRef.open(argv[1]); @@ -37,7 +37,6 @@ int otbCompareAsciiTests4(int argc, char * argv[]) fileRef << "3\n"; fileRef.close(); - std::ofstream fileTest; fileTest.open(argv[2]); fileTest << "1.001\n"; diff --git a/Testing/Code/TestSystem/otbCompareAsciiTests5.cxx b/Testing/Code/TestSystem/otbCompareAsciiTests5.cxx index a080ac0c87..40b8572c18 100644 --- a/Testing/Code/TestSystem/otbCompareAsciiTests5.cxx +++ b/Testing/Code/TestSystem/otbCompareAsciiTests5.cxx @@ -23,12 +23,12 @@ int otbCompareAsciiTests5(int argc, char * argv[]) { - if ( argc != 3 ) - { + if (argc != 3) + { std::cerr << "Usage: " << argv[0]; std::cerr << " referenceFile testFile" << std::endl; return EXIT_FAILURE; - } + } std::ofstream fileRef; fileRef.open(argv[1]); @@ -37,7 +37,6 @@ int otbCompareAsciiTests5(int argc, char * argv[]) fileRef << "[ 3 3 3 ]\n"; fileRef.close(); - std::ofstream fileTest; fileTest.open(argv[2]); fileTest << "[ 3.010 2.999 3.000 ]\n"; diff --git a/Testing/Code/Visu/otbDoubleImageViewerWithLink.cxx b/Testing/Code/Visu/otbDoubleImageViewerWithLink.cxx index ac246be4c5..fd6d8a5568 100644 --- a/Testing/Code/Visu/otbDoubleImageViewerWithLink.cxx +++ b/Testing/Code/Visu/otbDoubleImageViewerWithLink.cxx @@ -20,16 +20,16 @@ #include "otbImageViewer.h" #include "otbMacro.h" -int otbDoubleImageViewerWithLink( int argc, char * argv[] ) +int otbDoubleImageViewerWithLink(int argc, char * argv[]) { char * filename1 = argv[1]; char * filename2 = argv[2]; // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - typedef ImageViewerType::OffsetType OffsetType; - typedef ImageViewerType::ImageType ImageType; + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef ImageViewerType::OffsetType OffsetType; + typedef ImageViewerType::ImageType ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; // instantiation @@ -62,12 +62,10 @@ int otbDoubleImageViewerWithLink( int argc, char * argv[] ) // CASE 3: Link with Offset OffsetType offset; offset.Fill(50); - viewer2->Link(viewer1,offset); + viewer2->Link(viewer1, offset); viewer1->Show(); viewer2->Show(); Fl::check(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Visu/otbFixedSizeFullImageWidget.cxx b/Testing/Code/Visu/otbFixedSizeFullImageWidget.cxx index 75a8e9d55a..1528d2f8c6 100644 --- a/Testing/Code/Visu/otbFixedSizeFullImageWidget.cxx +++ b/Testing/Code/Visu/otbFixedSizeFullImageWidget.cxx @@ -19,41 +19,40 @@ #include "otbImageFileReader.h" #include <FL/Fl.H> - -int otbFixedSizeFullImageWidget( int argc, char * argv[] ) +int otbFixedSizeFullImageWidget(int argc, char * argv[]) { char * filename = argv[1]; - typedef float PixelType; + typedef float PixelType; typedef otb::FixedSizeFullImageWidget<PixelType> WidgetType; - typedef WidgetType::ImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef WidgetType::ImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); - ImageType::SizeType size; - ImageType::IndexType index; + ReaderType::Pointer reader = ReaderType::New(); + ImageType::SizeType size; + ImageType::IndexType index; ImageType::RegionType region; - index[0]=0; - index[1]=0; - size[0]=1; - size[1]=1; + index[0] = 0; + index[1] = 0; + size[0] = 1; + size[1] = 1; reader->SetFileName(filename); reader->Update(); - Fl_Window window(size[0],size[1]); + Fl_Window window(size[0], size[1]); WidgetType::Pointer widget = WidgetType::New(); window.resizable(widget.GetPointer()); widget->SetInput(reader->GetOutput()); - if (reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) - { + if (reader->GetOutput()->GetNumberOfComponentsPerPixel() >= 3) + { widget->SetViewModel(WidgetType::RGB); - } + } else - { + { widget->SetViewModel(WidgetType::GRAYSCALE); - } - widget->Init(0,0,size[0],size[1],"Test Full Image Widget"); + } + widget->Init(0, 0, size[0], size[1], "Test Full Image Widget"); widget->redraw(); window.end(); window.show(); @@ -62,25 +61,24 @@ int otbFixedSizeFullImageWidget( int argc, char * argv[] ) widget->redraw(); Fl::check(); - for (int i = 0;i<=400;i+=40) - { + for (int i = 0; i <= 400; i += 40) + { Fl::check(); - window.resize(0,0,i,i); + window.resize(0, 0, i, i); Fl::wait(0.2); Fl::check(); - } + } - for (int i = 400;i>=0;i-=40) - { + for (int i = 400; i >= 0; i -= 40) + { Fl::check(); - window.resize(0,0,i,i); + window.resize(0, 0, i, i); Fl::wait(0.2); Fl::check(); - } + } // suppres child, without delete memory. // delete memory is ITK respoability, since WidgetType::New() window.remove(widget.GetPointer()); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbFixedSizeFullImageWidgetNew.cxx b/Testing/Code/Visu/otbFixedSizeFullImageWidgetNew.cxx index 708a37026c..17d705f2e2 100644 --- a/Testing/Code/Visu/otbFixedSizeFullImageWidgetNew.cxx +++ b/Testing/Code/Visu/otbFixedSizeFullImageWidgetNew.cxx @@ -17,13 +17,12 @@ =========================================================================*/ #include "otbFixedSizeFullImageWidget.h" -int otbFixedSizeFullImageWidgetNew( int argc, char * argv[] ) +int otbFixedSizeFullImageWidgetNew(int argc, char * argv[]) { - typedef float PixelType; + typedef float PixelType; typedef otb::FixedSizeFullImageWidget<PixelType> WidgetType; WidgetType::Pointer widget = WidgetType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbFullResolutionImageWidget.cxx b/Testing/Code/Visu/otbFullResolutionImageWidget.cxx index 12be721c22..eca91bd81e 100644 --- a/Testing/Code/Visu/otbFullResolutionImageWidget.cxx +++ b/Testing/Code/Visu/otbFullResolutionImageWidget.cxx @@ -19,38 +19,35 @@ #include "otbImageFileReader.h" #include <FL/Fl.H> - -int otbFullResolutionImageWidget( int argc, char * argv[] ) +int otbFullResolutionImageWidget(int argc, char * argv[]) { char * filename = argv[1]; - typedef float PixelType; + typedef float PixelType; typedef otb::FullResolutionImageWidget<PixelType> WidgetType; - typedef WidgetType::ImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef WidgetType::ImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); - ImageType::SizeType size; - ImageType::IndexType index; + ReaderType::Pointer reader = ReaderType::New(); + ImageType::SizeType size; + ImageType::IndexType index; ImageType::RegionType region; - index[0]=0; - index[1]=0; - size[0]=1; - size[1]=1; + index[0] = 0; + index[1] = 0; + size[0] = 1; + size[1] = 1; reader->SetFileName(filename); reader->Update(); - Fl_Window window(size[0],size[1]); + Fl_Window window(size[0], size[1]); WidgetType::Pointer widget = WidgetType::New(); window.resizable(widget.GetPointer()); widget->SetInput(reader->GetOutput()); - if (reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) - widget->SetViewModel(WidgetType::RGB); - else - widget->SetViewModel(WidgetType::GRAYSCALE); + if (reader->GetOutput()->GetNumberOfComponentsPerPixel() >= 3) widget->SetViewModel(WidgetType::RGB); + else widget->SetViewModel(WidgetType::GRAYSCALE); widget->SetUpperLeftCorner(index); - widget->Init(0,0,size[0],size[1],"Test Full Resolution Widget"); + widget->Init(0, 0, size[0], size[1], "Test Full Resolution Widget"); widget->redraw(); window.end(); window.show(); @@ -59,27 +56,26 @@ int otbFullResolutionImageWidget( int argc, char * argv[] ) widget->redraw(); Fl::check(); - int StepX =(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]-size[0])/100; - int StepY =(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]-size[1])/100; - for (int i = 0;i<=100;i+=5) - { + int StepX = (reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0] - size[0]) / 100; + int StepY = (reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1] - size[1]) / 100; + for (int i = 0; i <= 100; i += 5) + { Fl::check(); - window.resize(0,0,size[0]+i*StepX,size[1]+i*StepY); + window.resize(0, 0, size[0] + i * StepX, size[1] + i * StepY); Fl::wait(0.2); Fl::check(); - } + } - for (int i = 100;i>=0;i-=5) - { + for (int i = 100; i >= 0; i -= 5) + { Fl::check(); - window.resize(0,0,size[0]+i*StepX,size[1]+i*StepY); + window.resize(0, 0, size[0] + i * StepX, size[1] + i * StepY); Fl::wait(0.2); Fl::check(); - } + } // suppres child, without delete memory. // delete memory is ITK respoability, since WidgetType::New() window.remove(widget.GetPointer()); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbFullResolutionImageWidgetNew.cxx b/Testing/Code/Visu/otbFullResolutionImageWidgetNew.cxx index 0b0837ef6a..81b019cbb1 100644 --- a/Testing/Code/Visu/otbFullResolutionImageWidgetNew.cxx +++ b/Testing/Code/Visu/otbFullResolutionImageWidgetNew.cxx @@ -17,13 +17,12 @@ =========================================================================*/ #include "otbFullResolutionImageWidget.h" -int otbFullResolutionImageWidgetNew( int argc, char * argv[] ) +int otbFullResolutionImageWidgetNew(int argc, char * argv[]) { - typedef float PixelType; + typedef float PixelType; typedef otb::FullResolutionImageWidget<PixelType> WidgetType; WidgetType::Pointer widget = WidgetType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbHistogramAndTransferFunctionWidget.cxx b/Testing/Code/Visu/otbHistogramAndTransferFunctionWidget.cxx index 9fbe2a9506..af8c92083d 100644 --- a/Testing/Code/Visu/otbHistogramAndTransferFunctionWidget.cxx +++ b/Testing/Code/Visu/otbHistogramAndTransferFunctionWidget.cxx @@ -24,23 +24,23 @@ int otbHistogramAndTransferFunctionWidget(int argc, char * argv[]) { typedef unsigned char PixelType; - const unsigned int Dimension =2; + const unsigned int Dimension = 2; const char * infname = argv[1]; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; typedef itk::Statistics::ScalarImageToHistogramGenerator<ImageType> GeneratorType; - typedef GeneratorType::HistogramType HistogramType; + typedef GeneratorType::HistogramType HistogramType; - typedef otb::HistogramAndTransferFunctionWidget<HistogramType,PixelType> WidgetType; - typedef otb::ImageWidgetAffineTransferFunction<PixelType> TransferFunctionType; + typedef otb::HistogramAndTransferFunctionWidget<HistogramType, PixelType> WidgetType; + typedef otb::ImageWidgetAffineTransferFunction<PixelType> TransferFunctionType; TransferFunctionType::Pointer function = TransferFunctionType::New(); function->SetLowerBound(50); function->SetUpperBound(200); - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); GeneratorType::Pointer generator = GeneratorType::New(); reader->SetFileName(infname); @@ -49,13 +49,13 @@ int otbHistogramAndTransferFunctionWidget(int argc, char * argv[]) generator->SetInput(reader->GetOutput()); generator->SetNumberOfBins(255); generator->Compute(); - std::cout<<generator->GetOutput()->GetSize()<<std::endl; + std::cout << generator->GetOutput()->GetSize() << std::endl; - Fl_Window window(300,200); + Fl_Window window(300, 200); WidgetType::Pointer widget = WidgetType::New(); widget->SetHistogram(generator->GetOutput()); widget->SetTransferFunction(function); - widget->resize(0,0,300,200); + widget->resize(0, 0, 300, 200); window.resizable(widget.GetPointer()); window.end(); window.show(); diff --git a/Testing/Code/Visu/otbHistogramAndTransferFunctionWidgetNew.cxx b/Testing/Code/Visu/otbHistogramAndTransferFunctionWidgetNew.cxx index c18f61478f..15c30a26e9 100644 --- a/Testing/Code/Visu/otbHistogramAndTransferFunctionWidgetNew.cxx +++ b/Testing/Code/Visu/otbHistogramAndTransferFunctionWidgetNew.cxx @@ -22,12 +22,12 @@ int otbHistogramAndTransferFunctionWidgetNew(int argc, char * argv[]) { typedef unsigned char PixelType; - const unsigned int Dimension =2; - typedef otb::Image<PixelType,Dimension> ImageType; + const unsigned int Dimension = 2; + typedef otb::Image<PixelType, Dimension> ImageType; typedef itk::Statistics::ScalarImageToHistogramGenerator<ImageType> GeneratorType; - typedef GeneratorType::HistogramType HistogramType; + typedef GeneratorType::HistogramType HistogramType; - typedef otb::HistogramAndTransferFunctionWidget<HistogramType,PixelType> WidgetType; + typedef otb::HistogramAndTransferFunctionWidget<HistogramType, PixelType> WidgetType; WidgetType::Pointer widget = WidgetType::New(); diff --git a/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilter.cxx b/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilter.cxx index 34551f02cc..4eee67dabb 100644 --- a/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilter.cxx +++ b/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilter.cxx @@ -28,11 +28,11 @@ int otbImageToGrayscaleAnaglyphImageFilter(int argc, char * argv[]) const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::ImageToGrayscaleAnaglyphImageFilter<ImageType,ImageType,VectorImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::ImageToGrayscaleAnaglyphImageFilter<ImageType, ImageType, VectorImageType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); @@ -49,6 +49,5 @@ int otbImageToGrayscaleAnaglyphImageFilter(int argc, char * argv[]) writer->SetInput(filter->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilterNew.cxx b/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilterNew.cxx index 9448e0db06..12f3a54322 100644 --- a/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilterNew.cxx +++ b/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilterNew.cxx @@ -26,9 +26,9 @@ int otbImageToGrayscaleAnaglyphImageFilterNew(int argc, char * argv[]) const unsigned int Dimension = 2; typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::ImageToGrayscaleAnaglyphImageFilter<ImageType,ImageType,VectorImageType> FilterType; + typedef otb::Image<PixelType, Dimension> ImageType; + typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + typedef otb::ImageToGrayscaleAnaglyphImageFilter<ImageType, ImageType, VectorImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); diff --git a/Testing/Code/Visu/otbImageViewer.cxx b/Testing/Code/Visu/otbImageViewer.cxx index 7d18ff1d1b..79247b1dad 100644 --- a/Testing/Code/Visu/otbImageViewer.cxx +++ b/Testing/Code/Visu/otbImageViewer.cxx @@ -20,15 +20,15 @@ #include "otbImageViewer.h" #include "otbMacro.h" -int otbImageViewer( int argc, char * argv[] ) +int otbImageViewer(int argc, char * argv[]) { char * filename = argv[1]; // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - typedef ImageViewerType::ImageType ImageType; - typedef ImageViewerType::ViewModelType ViewModelType; + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef ImageViewerType::ImageType ImageType; + typedef ImageViewerType::ViewModelType ViewModelType; typedef otb::ImageFileReader<ImageType> ReaderType; ViewModelType mode = static_cast<ViewModelType>(atoi(argv[2])); @@ -50,8 +50,5 @@ int otbImageViewer( int argc, char * argv[] ) Fl::check(); // Fl::run(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Visu/otbImageViewerNew.cxx b/Testing/Code/Visu/otbImageViewerNew.cxx index 22eb8a7e2c..0ea49440f1 100644 --- a/Testing/Code/Visu/otbImageViewerNew.cxx +++ b/Testing/Code/Visu/otbImageViewerNew.cxx @@ -20,15 +20,13 @@ #include "otbImageViewer.h" #include "otbMacro.h" -int otbImageViewerNew( int argc, char * argv[] ) +int otbImageViewerNew(int argc, char * argv[]) { // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; // instantiation ImageViewerType::Pointer viewer = ImageViewerType::New(); return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Visu/otbImageViewerWithMultiBandFilter.cxx b/Testing/Code/Visu/otbImageViewerWithMultiBandFilter.cxx index a0c65df031..c00cd0fe18 100644 --- a/Testing/Code/Visu/otbImageViewerWithMultiBandFilter.cxx +++ b/Testing/Code/Visu/otbImageViewerWithMultiBandFilter.cxx @@ -23,23 +23,22 @@ #include "otbPerBandVectorImageFilter.h" #include "otbImage.h" - -int otbImageViewerWithMultiBandFilter( int argc, char * argv[] ) +int otbImageViewerWithMultiBandFilter(int argc, char * argv[]) { char * filename = argv[1]; // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - typedef ImageViewerType::ImageType VectorImageType; - typedef ImageViewerType::SingleImageType ImageType; - typedef itk::SobelEdgeDetectionImageFilter<ImageType,ImageType> FilterType; - typedef otb::PerBandVectorImageFilter<VectorImageType,VectorImageType,FilterType> + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef ImageViewerType::ImageType VectorImageType; + typedef ImageViewerType::SingleImageType ImageType; + typedef itk::SobelEdgeDetectionImageFilter<ImageType, ImageType> FilterType; + typedef otb::PerBandVectorImageFilter<VectorImageType, VectorImageType, FilterType> PerBandFilterType; typedef otb::ImageFileReader<VectorImageType> ReaderType; // instantiation - ImageViewerType::Pointer viewer = ImageViewerType::New(); + ImageViewerType::Pointer viewer = ImageViewerType::New(); PerBandFilterType::Pointer filter = PerBandFilterType::New(); // check for input images @@ -49,8 +48,8 @@ int otbImageViewerWithMultiBandFilter( int argc, char * argv[] ) filter->SetInput(reader->GetOutput()); filter->UpdateOutputInformation(); - std::cout<<"Main - number of bands: "<<filter->GetOutput()->GetNumberOfComponentsPerPixel()<<std::endl; - std::cout<<"Main - largest region: "<<filter->GetOutput()->GetLargestPossibleRegion()<<std::endl; + std::cout << "Main - number of bands: " << filter->GetOutput()->GetNumberOfComponentsPerPixel() << std::endl; + std::cout << "Main - largest region: " << filter->GetOutput()->GetLargestPossibleRegion() << std::endl; viewer->SetImage(filter->GetOutput()); @@ -60,5 +59,3 @@ int otbImageViewerWithMultiBandFilter( int argc, char * argv[] ) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Visu/otbImageViewerWithOtbImage.cxx b/Testing/Code/Visu/otbImageViewerWithOtbImage.cxx index 6dc3b1ef6f..9c570bd368 100644 --- a/Testing/Code/Visu/otbImageViewerWithOtbImage.cxx +++ b/Testing/Code/Visu/otbImageViewerWithOtbImage.cxx @@ -20,15 +20,15 @@ #include "otbImageViewer.h" #include "otbMacro.h" -int otbImageViewerWithOtbImage( int argc, char * argv[] ) +int otbImageViewerWithOtbImage(int argc, char * argv[]) { char * filename = argv[1]; // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; typedef ImageViewerType::SingleImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; // instantiation ImageViewerType::Pointer viewer = ImageViewerType::New(); @@ -43,8 +43,5 @@ int otbImageViewerWithOtbImage( int argc, char * argv[] ) viewer->Show(); Fl::check(); - return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Visu/otbImageViewerWithOverlay.cxx b/Testing/Code/Visu/otbImageViewerWithOverlay.cxx index ad94e8eb3b..5236e81e56 100644 --- a/Testing/Code/Visu/otbImageViewerWithOverlay.cxx +++ b/Testing/Code/Visu/otbImageViewerWithOverlay.cxx @@ -22,28 +22,27 @@ #include "itkBinaryThresholdImageFilter.h" #include "otbChangeLabelImageFilter.h" -int otbImageViewerWithOverlay( int argc, char * argv[] ) +int otbImageViewerWithOverlay(int argc, char * argv[]) { - char * filename = argv[1]; - double upperThresh = atof(argv[2]); + char * filename = argv[1]; + double upperThresh = atof(argv[2]); unsigned char opacity = atoi(argv[3]); - // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - typedef ImageViewerType::SingleImageType ImageType; - typedef ImageViewerType::ViewModelType ViewModelType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef ImageViewerType::OverlayImageType OverlayImageType; - typedef otb::Image<unsigned short,2> LabeledImageType; - typedef itk::BinaryThresholdImageFilter<ImageType,LabeledImageType> ThresholdFilterType; - typedef otb::ChangeLabelImageFilter<LabeledImageType,OverlayImageType> ChangeLabelFilterType; - typedef OverlayImageType::PixelType OverlayPixelType; + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef ImageViewerType::SingleImageType ImageType; + typedef ImageViewerType::ViewModelType ViewModelType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef ImageViewerType::OverlayImageType OverlayImageType; + typedef otb::Image<unsigned short, 2> LabeledImageType; + typedef itk::BinaryThresholdImageFilter<ImageType, LabeledImageType> ThresholdFilterType; + typedef otb::ChangeLabelImageFilter<LabeledImageType, OverlayImageType> ChangeLabelFilterType; + typedef OverlayImageType::PixelType OverlayPixelType; // instantiation - ImageViewerType::Pointer viewer = ImageViewerType::New(); - ThresholdFilterType::Pointer thresh = ThresholdFilterType::New(); + ImageViewerType::Pointer viewer = ImageViewerType::New(); + ThresholdFilterType::Pointer thresh = ThresholdFilterType::New(); ChangeLabelFilterType::Pointer chLabel = ChangeLabelFilterType::New(); // check for input images @@ -59,22 +58,21 @@ int otbImageViewerWithOverlay( int argc, char * argv[] ) chLabel->SetInput(thresh->GetOutput()); - OverlayPixelType insideValue,outsideValue; + OverlayPixelType insideValue, outsideValue; insideValue.SetSize(3); insideValue.Fill(0); - insideValue[0]=255; + insideValue[0] = 255; outsideValue.SetSize(3); outsideValue.Fill(0); - outsideValue[2]=255; + outsideValue[2] = 255; chLabel->SetNumberOfComponentsPerPixel(3); - chLabel->SetChange(0,outsideValue); - chLabel->SetChange(1,insideValue); + chLabel->SetChange(0, outsideValue); + chLabel->SetChange(1, insideValue); chLabel->GetOutput()->UpdateOutputInformation(); - viewer->SetImage(reader->GetOutput()); viewer->SetImageOverlay(chLabel->GetOutput()); viewer->SetUseImageOverlay(true); @@ -92,5 +90,3 @@ int otbImageViewerWithOverlay( int argc, char * argv[] ) return EXIT_SUCCESS; } - - diff --git a/Testing/Code/Visu/otbImageWidgetBaseNew.cxx b/Testing/Code/Visu/otbImageWidgetBaseNew.cxx index 1fb9652669..6906938654 100644 --- a/Testing/Code/Visu/otbImageWidgetBaseNew.cxx +++ b/Testing/Code/Visu/otbImageWidgetBaseNew.cxx @@ -17,13 +17,12 @@ =========================================================================*/ #include "otbImageWidgetBase.h" -int otbImageWidgetBaseNew( int argc, char * argv[] ) +int otbImageWidgetBaseNew(int argc, char * argv[]) { - typedef float PixelType; + typedef float PixelType; typedef otb::ImageWidgetBase<PixelType> WidgetType; WidgetType::Pointer widget = WidgetType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageWidgetPolygonForm.cxx b/Testing/Code/Visu/otbImageWidgetPolygonForm.cxx index 55ad8de9f3..4284d4f8e5 100644 --- a/Testing/Code/Visu/otbImageWidgetPolygonForm.cxx +++ b/Testing/Code/Visu/otbImageWidgetPolygonForm.cxx @@ -20,19 +20,18 @@ #include "otbImageWidgetPolygonForm.h" #include <FL/Fl.H> - -int otbImageWidgetPolygonForm( int argc, char * argv[] ) +int otbImageWidgetPolygonForm(int argc, char * argv[]) { char * filename = argv[1]; - typedef float PixelType; + typedef float PixelType; typedef otb::FullResolutionImageWidget<PixelType> WidgetType; //typedef otb::ZoomableImageWidget<PixelType> WidgetType; - typedef WidgetType::ImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageWidgetPolygonForm<> WidgetPolyFormType; - typedef WidgetPolyFormType::PolygonType PolyType; - typedef WidgetPolyFormType::VertexType VertexType; - typedef WidgetPolyFormType::VertexListType VertexListType; + typedef WidgetType::ImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageWidgetPolygonForm<> WidgetPolyFormType; + typedef WidgetPolyFormType::PolygonType PolyType; + typedef WidgetPolyFormType::VertexType VertexType; + typedef WidgetPolyFormType::VertexListType VertexListType; typedef WidgetPolyFormType::ContinuousIndexType ContinuousIndexType; ReaderType::Pointer reader = ReaderType::New(); @@ -42,46 +41,46 @@ int otbImageWidgetPolygonForm( int argc, char * argv[] ) // Reading vertices from command line int cpt = 2; - while ( argv[cpt] != NULL && argv[cpt+1]!= NULL) - { + while (argv[cpt] != NULL && argv[cpt + 1] != NULL) + { ContinuousIndexType newVertex; - newVertex[0]=atof(argv[cpt]); - newVertex[1]=atof(argv[cpt+1]); + newVertex[0] = atof(argv[cpt]); + newVertex[1] = atof(argv[cpt + 1]); wigdetpolyForm->GetPolygon()->AddVertex(newVertex); ++cpt; ++cpt; - } + } - ImageType::SizeType size; - ImageType::IndexType index; + ImageType::SizeType size; + ImageType::IndexType index; ImageType::RegionType region; - index[0]=0; - index[1]=0; - size[0]=200; - size[1]=200; + index[0] = 0; + index[1] = 0; + size[0] = 200; + size[1] = 200; reader->SetFileName(filename); reader->Update(); - Fl_Window window(size[0],size[1]); + Fl_Window window(size[0], size[1]); - WidgetType::Pointer widget = WidgetType::New(); + WidgetType::Pointer widget = WidgetType::New(); window.resizable(widget.GetPointer()); widget->SetInput(reader->GetOutput()); - widget->GetFormList()->PushBack( wigdetpolyForm ); + widget->GetFormList()->PushBack(wigdetpolyForm); widget->SetFormOverlayVisible(true); - if (reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) - { + if (reader->GetOutput()->GetNumberOfComponentsPerPixel() >= 3) + { widget->SetViewModel(WidgetType::RGB); - } + } else - { + { widget->SetViewModel(WidgetType::GRAYSCALE); - } + } widget->SetUpperLeftCorner(index); - widget->Init(0,0,size[0],size[1],"Test Full Resolution Widget"); + widget->Init(0, 0, size[0], size[1], "Test Full Resolution Widget"); widget->redraw(); window.end(); window.show(); diff --git a/Testing/Code/Visu/otbImageWidgetPolygonFormNew.cxx b/Testing/Code/Visu/otbImageWidgetPolygonFormNew.cxx index 0c4f150f7e..6c81e81eee 100644 --- a/Testing/Code/Visu/otbImageWidgetPolygonFormNew.cxx +++ b/Testing/Code/Visu/otbImageWidgetPolygonFormNew.cxx @@ -20,12 +20,10 @@ #include "otbImageWidgetPolygonForm.h" #include <FL/Fl.H> - -int otbImageWidgetPolygonFormNew( int argc, char * argv[] ) +int otbImageWidgetPolygonFormNew(int argc, char * argv[]) { - typedef otb::ImageWidgetPolygonForm<> PolyFormType; + typedef otb::ImageWidgetPolygonForm<> PolyFormType; PolyFormType::Pointer polyForm = PolyFormType::New(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageWidgetTransferFunctions.cxx b/Testing/Code/Visu/otbImageWidgetTransferFunctions.cxx index a76b26f7db..61437bc58c 100644 --- a/Testing/Code/Visu/otbImageWidgetTransferFunctions.cxx +++ b/Testing/Code/Visu/otbImageWidgetTransferFunctions.cxx @@ -23,17 +23,17 @@ int otbImageWidgetTransferFunctions(int argc, char * argv[]) { const char * outfname = argv[1]; - typedef double PixelType; - typedef otb::ImageWidgetAffineTransferFunction<PixelType> AffineType; + typedef double PixelType; + typedef otb::ImageWidgetAffineTransferFunction<PixelType> AffineType; typedef otb::ImageWidgetSquareRootTransferFunction<PixelType> SquareRootType; - typedef otb::ImageWidgetLogTransferFunction<PixelType> LogType; - typedef otb::ImageWidgetSquareTransferFunction<PixelType> SquareType; + typedef otb::ImageWidgetLogTransferFunction<PixelType> LogType; + typedef otb::ImageWidgetSquareTransferFunction<PixelType> SquareType; // Instantiation - AffineType::Pointer affine = AffineType::New(); - LogType::Pointer log = LogType::New(); + AffineType::Pointer affine = AffineType::New(); + LogType::Pointer log = LogType::New(); SquareRootType::Pointer squareRoot = SquareRootType::New(); - SquareType::Pointer square = SquareType::New(); + SquareType::Pointer square = SquareType::New(); PixelType min = 10; PixelType max = 20; @@ -50,22 +50,22 @@ int otbImageWidgetTransferFunctions(int argc, char * argv[]) std::ofstream file; file.open(outfname); - file<<"Affine transfer function: "<<std::endl; - file<<"Out of bounds (lower): "<<(int)affine->Map(0)<<std::endl; - file<<"Out of bounds (lower): "<<(int)affine->Map(30)<<std::endl; - file<<"Inside bounds (lower): "<<(int)affine->Map(15)<<std::endl; - file<<"Log transfer function: "<<std::endl; - file<<"Out of bounds (lower): "<<(int)log->Map(0)<<std::endl; - file<<"Out of bounds (lower): "<<(int)log->Map(30)<<std::endl; - file<<"Inside bounds (lower): "<<(int)log->Map(15)<<std::endl; - file<<"Square root transfer function: "<<std::endl; - file<<"Out of bounds (lower): "<<(int)squareRoot->Map(0)<<std::endl; - file<<"Out of bounds (lower): "<<(int)squareRoot->Map(30)<<std::endl; - file<<"Inside bounds (lower): "<<(int)squareRoot->Map(15)<<std::endl; - file<<"Square transfer function: "<<std::endl; - file<<"Out of bounds (lower): "<<(int)square->Map(0)<<std::endl; - file<<"Out of bounds (lower): "<<(int)square->Map(30)<<std::endl; - file<<"Inside bounds (lower): "<<(int)square->Map(15)<<std::endl; + file << "Affine transfer function: " << std::endl; + file << "Out of bounds (lower): " << (int) affine->Map(0) << std::endl; + file << "Out of bounds (lower): " << (int) affine->Map(30) << std::endl; + file << "Inside bounds (lower): " << (int) affine->Map(15) << std::endl; + file << "Log transfer function: " << std::endl; + file << "Out of bounds (lower): " << (int) log->Map(0) << std::endl; + file << "Out of bounds (lower): " << (int) log->Map(30) << std::endl; + file << "Inside bounds (lower): " << (int) log->Map(15) << std::endl; + file << "Square root transfer function: " << std::endl; + file << "Out of bounds (lower): " << (int) squareRoot->Map(0) << std::endl; + file << "Out of bounds (lower): " << (int) squareRoot->Map(30) << std::endl; + file << "Inside bounds (lower): " << (int) squareRoot->Map(15) << std::endl; + file << "Square transfer function: " << std::endl; + file << "Out of bounds (lower): " << (int) square->Map(0) << std::endl; + file << "Out of bounds (lower): " << (int) square->Map(30) << std::endl; + file << "Inside bounds (lower): " << (int) square->Map(15) << std::endl; file.close(); diff --git a/Testing/Code/Visu/otbImageWidgetTransferFunctionsNew.cxx b/Testing/Code/Visu/otbImageWidgetTransferFunctionsNew.cxx index 64f58afe87..67e6d9fad6 100644 --- a/Testing/Code/Visu/otbImageWidgetTransferFunctionsNew.cxx +++ b/Testing/Code/Visu/otbImageWidgetTransferFunctionsNew.cxx @@ -20,17 +20,17 @@ int otbImageWidgetTransferFunctionsNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::ImageWidgetAffineTransferFunction<PixelType> AffineType; + typedef double PixelType; + typedef otb::ImageWidgetAffineTransferFunction<PixelType> AffineType; typedef otb::ImageWidgetSquareRootTransferFunction<PixelType> SquareRootType; - typedef otb::ImageWidgetLogTransferFunction<PixelType> LogType; - typedef otb::ImageWidgetSquareTransferFunction<PixelType> SquareType; + typedef otb::ImageWidgetLogTransferFunction<PixelType> LogType; + typedef otb::ImageWidgetSquareTransferFunction<PixelType> SquareType; // Instantiation - AffineType::Pointer affine = AffineType::New(); - LogType::Pointer log = LogType::New(); + AffineType::Pointer affine = AffineType::New(); + LogType::Pointer log = LogType::New(); SquareRootType::Pointer squareRoot = SquareRootType::New(); - SquareType::Pointer square = SquareType::New(); + SquareType::Pointer square = SquareType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilter.cxx b/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilter.cxx index b65e853f3e..a6f76704dc 100644 --- a/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilter.cxx +++ b/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilter.cxx @@ -27,10 +27,14 @@ int otbVectorImageToColorAnaglyphVectorImageFilter(int argc, char * argv[]) const unsigned int Dimension = 2; typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::VectorImageToColorAnaglyphVectorImageFilter<VectorImageType,VectorImageType,VectorImageType> FilterType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; + typedef otb::VectorImage<PixelType, + Dimension> VectorImageType; + typedef otb::VectorImageToColorAnaglyphVectorImageFilter<VectorImageType, VectorImageType, + VectorImageType> FilterType; + typedef otb::ImageFileReader<VectorImageType> + ReaderType; + typedef otb::StreamingImageFileWriter<VectorImageType> + WriterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); diff --git a/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilterNew.cxx b/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilterNew.cxx index f0f360ede5..840b85bfc1 100644 --- a/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilterNew.cxx +++ b/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilterNew.cxx @@ -25,8 +25,10 @@ int otbVectorImageToColorAnaglyphVectorImageFilterNew(int argc, char * argv[]) const unsigned int Dimension = 2; typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::VectorImageToColorAnaglyphVectorImageFilter<VectorImageType,VectorImageType,VectorImageType> FilterType; + typedef otb::VectorImage<PixelType, + Dimension> VectorImageType; + typedef otb::VectorImageToColorAnaglyphVectorImageFilter<VectorImageType, VectorImageType, + VectorImageType> FilterType; // Instantiating object FilterType::Pointer object = FilterType::New(); diff --git a/Testing/Code/Visu/otbVisuTests2.cxx b/Testing/Code/Visu/otbVisuTests2.cxx index f6292ed34d..41853084a7 100644 --- a/Testing/Code/Visu/otbVisuTests2.cxx +++ b/Testing/Code/Visu/otbVisuTests2.cxx @@ -26,17 +26,17 @@ void RegisterTests() { -REGISTER_TEST(otbImageViewerWithMultiBandFilter); -REGISTER_TEST(otbDoubleImageViewerWithLink); -REGISTER_TEST(otbImageToGrayscaleAnaglyphImageFilterNew); -REGISTER_TEST(otbImageToGrayscaleAnaglyphImageFilter); -REGISTER_TEST(otbVectorImageToColorAnaglyphVectorImageFilterNew); -REGISTER_TEST(otbVectorImageToColorAnaglyphVectorImageFilter); -REGISTER_TEST(otbImageWidgetPolygonFormNew); -REGISTER_TEST(otbImageWidgetPolygonForm); -REGISTER_TEST(otbHistogramAndTransferFunctionWidgetNew); -REGISTER_TEST(otbHistogramAndTransferFunctionWidget); -REGISTER_TEST(otbImageWidgetTransferFunctionsNew); -REGISTER_TEST(otbImageWidgetTransferFunctions); -REGISTER_TEST(otbImageViewerWithOverlay); + REGISTER_TEST(otbImageViewerWithMultiBandFilter); + REGISTER_TEST(otbDoubleImageViewerWithLink); + REGISTER_TEST(otbImageToGrayscaleAnaglyphImageFilterNew); + REGISTER_TEST(otbImageToGrayscaleAnaglyphImageFilter); + REGISTER_TEST(otbVectorImageToColorAnaglyphVectorImageFilterNew); + REGISTER_TEST(otbVectorImageToColorAnaglyphVectorImageFilter); + REGISTER_TEST(otbImageWidgetPolygonFormNew); + REGISTER_TEST(otbImageWidgetPolygonForm); + REGISTER_TEST(otbHistogramAndTransferFunctionWidgetNew); + REGISTER_TEST(otbHistogramAndTransferFunctionWidget); + REGISTER_TEST(otbImageWidgetTransferFunctionsNew); + REGISTER_TEST(otbImageWidgetTransferFunctions); + REGISTER_TEST(otbImageViewerWithOverlay); } diff --git a/Testing/Code/Visu/otbZoomableImageWidget.cxx b/Testing/Code/Visu/otbZoomableImageWidget.cxx index b009532492..908c3c98be 100644 --- a/Testing/Code/Visu/otbZoomableImageWidget.cxx +++ b/Testing/Code/Visu/otbZoomableImageWidget.cxx @@ -19,33 +19,30 @@ #include "otbImageFileReader.h" #include <FL/Fl.H> - -int otbZoomableImageWidget( int argc, char * argv[] ) +int otbZoomableImageWidget(int argc, char * argv[]) { char * filename = argv[1]; - typedef float PixelType; + typedef float PixelType; typedef otb::ZoomableImageWidget<PixelType> WidgetType; - typedef WidgetType::ImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + typedef WidgetType::ImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); - ImageType::SizeType size; - ImageType::IndexType index; + ReaderType::Pointer reader = ReaderType::New(); + ImageType::SizeType size; + ImageType::IndexType index; ImageType::RegionType region; reader->SetFileName(filename); reader->Update(); - size=reader->GetOutput()->GetLargestPossibleRegion().GetSize(); + size = reader->GetOutput()->GetLargestPossibleRegion().GetSize(); - Fl_Window window(size[0],size[1]); + Fl_Window window(size[0], size[1]); WidgetType::Pointer widget = WidgetType::New(); window.resizable(widget.GetPointer()); widget->SetInput(reader->GetOutput()); - if (reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) - widget->SetViewModel(WidgetType::RGB); - else - widget->SetViewModel(WidgetType::GRAYSCALE); - widget->Init(0,0,size[0],size[1],"Test Full Image Widget"); + if (reader->GetOutput()->GetNumberOfComponentsPerPixel() >= 3) widget->SetViewModel(WidgetType::RGB); + else widget->SetViewModel(WidgetType::GRAYSCALE); + widget->Init(0, 0, size[0], size[1], "Test Full Image Widget"); widget->redraw(); window.end(); window.show(); @@ -54,30 +51,30 @@ int otbZoomableImageWidget( int argc, char * argv[] ) widget->redraw(); Fl::check(); - for (double zoom = 1.0;zoom<10.;zoom++) - { + for (double zoom = 1.0; zoom < 10.; zoom++) + { Fl::check(); - index[0]=size[0]/2-static_cast<int>(static_cast<double>(size[0]/2)/zoom+0.5); - index[1]=size[1]/2-static_cast<int>(static_cast<double>(size[1]/2)/zoom+0.5); + index[0] = size[0] / 2 - static_cast<int>(static_cast<double>(size[0] / 2) / zoom + 0.5); + index[1] = size[1] / 2 - static_cast<int>(static_cast<double>(size[1] / 2) / zoom + 0.5); widget->SetZoomUpperLeftCorner(index); widget->SetZoomFactor(zoom); widget->redraw(); Fl::wait(0.2); Fl::check(); - } + } - for (double zoom=10.;zoom>=1.;zoom--) - { + for (double zoom = 10.; zoom >= 1.; zoom--) + { Fl::check(); - index[0]=size[0]/2-static_cast<int>(static_cast<double>(size[0])/(2*zoom)+0.5); - index[1]=size[1]/2-static_cast<int>(static_cast<double>(size[1])/(2*zoom)+0.5); + index[0] = size[0] / 2 - static_cast<int>(static_cast<double>(size[0]) / (2 * zoom) + 0.5); + index[1] = size[1] / 2 - static_cast<int>(static_cast<double>(size[1]) / (2 * zoom) + 0.5); widget->SetZoomUpperLeftCorner(index); widget->SetZoomFactor(zoom); widget->redraw(); Fl::wait(0.2); Fl::check(); - } + } // suppres child, without delete memory. // delete memory is ITK respoability, since WidgetType::New() diff --git a/Testing/Code/Visu/otbZoomableImageWidgetNew.cxx b/Testing/Code/Visu/otbZoomableImageWidgetNew.cxx index f258a0de93..5d3207a05f 100644 --- a/Testing/Code/Visu/otbZoomableImageWidgetNew.cxx +++ b/Testing/Code/Visu/otbZoomableImageWidgetNew.cxx @@ -17,28 +17,27 @@ =========================================================================*/ #include "otbZoomableImageWidget.h" -int otbZoomableImageWidgetNew( int argc, char * argv[] ) +int otbZoomableImageWidgetNew(int argc, char * argv[]) { try - { - typedef float PixelType; + { + typedef float PixelType; typedef otb::ZoomableImageWidget<PixelType> WidgetType; WidgetType::Pointer widget = WidgetType::New(); - } + } - catch ( itk::ExceptionObject & err ) - { + catch (itk::ExceptionObject& err) + { std::cout << "Exception itk::ExceptionObject levee !" << std::endl; std::cout << err << std::endl; return EXIT_FAILURE; - } - catch ( ... ) - { + } + catch (...) + { std::cout << "Exception levee inconnue !" << std::endl; return EXIT_FAILURE; - } - + } return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbBlendingImageFilter.cxx b/Testing/Code/Visualization/otbBlendingImageFilter.cxx index 449f7deb78..ec99529b98 100644 --- a/Testing/Code/Visualization/otbBlendingImageFilter.cxx +++ b/Testing/Code/Visualization/otbBlendingImageFilter.cxx @@ -21,11 +21,11 @@ #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" -int otbBlendingImageFilter( int argc, char * argv[] ) +int otbBlendingImageFilter(int argc, char * argv[]) { typedef unsigned char ValueType; typedef itk::RGBPixel<ValueType> PixelType; - typedef otb::Image<PixelType,2> ImageType; + typedef otb::Image<PixelType, 2> ImageType; typedef otb::BlendingImageFilter<ImageType> BlendingFilterType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingImageFileWriter<ImageType> WriterType; diff --git a/Testing/Code/Visualization/otbBlendingImageFilterNew.cxx b/Testing/Code/Visualization/otbBlendingImageFilterNew.cxx index eb428b6fa9..1a281174ee 100644 --- a/Testing/Code/Visualization/otbBlendingImageFilterNew.cxx +++ b/Testing/Code/Visualization/otbBlendingImageFilterNew.cxx @@ -19,11 +19,11 @@ #include "otbImage.h" #include "itkRGBPixel.h" -int otbBlendingImageFilterNew( int argc, char * argv[] ) +int otbBlendingImageFilterNew(int argc, char * argv[]) { - typedef unsigned char ValueType; - typedef itk::RGBPixel<ValueType> PixelType; - typedef otb::Image<PixelType,2> ImageType; + typedef unsigned char ValueType; + typedef itk::RGBPixel<ValueType> PixelType; + typedef otb::Image<PixelType, 2> ImageType; typedef otb::BlendingImageFilter<ImageType> BlendingFilterType; BlendingFilterType::Pointer rendering = BlendingFilterType::New(); diff --git a/Testing/Code/Visualization/otbCurves2DWidget.cxx b/Testing/Code/Visualization/otbCurves2DWidget.cxx index 6d991ea7c1..06012870d1 100644 --- a/Testing/Code/Visualization/otbCurves2DWidget.cxx +++ b/Testing/Code/Visualization/otbCurves2DWidget.cxx @@ -18,30 +18,30 @@ #include "otbCurves2DWidget.h" #include <FL/Fl.H> -int otbCurves2DWidget( int argc, char * argv[] ) +int otbCurves2DWidget(int argc, char * argv[]) { - + // typedefs typedef otb::Curves2DWidget WidgetType; typedef WidgetType::PointType PointType; typedef WidgetType::VectorType VectorType; - PointType origin; + PointType origin; VectorType length; - PointType gridOrigin; + PointType gridOrigin; VectorType gridSpacing; - origin[0]=atof(argv[1]); - origin[1]=atof(argv[2]); - length[0]=atof(argv[3]); - length[1]=atof(argv[4]); - gridOrigin[0]=atof(argv[5]); - gridOrigin[1]=atof(argv[6]); - gridSpacing[0]=atof(argv[7]); - gridSpacing[1]=atof(argv[8]); + origin[0] = atof(argv[1]); + origin[1] = atof(argv[2]); + length[0] = atof(argv[3]); + length[1] = atof(argv[4]); + gridOrigin[0] = atof(argv[5]); + gridOrigin[1] = atof(argv[6]); + gridSpacing[0] = atof(argv[7]); + gridSpacing[1] = atof(argv[8]); const bool run = atoi(argv[9]); - - // Create a widget + + // Create a widget WidgetType::Pointer widget = WidgetType::New(); widget->SetAxisOrigin(origin); widget->SetAxisLength(length); @@ -49,16 +49,16 @@ int otbCurves2DWidget( int argc, char * argv[] ) widget->SetGridSpacing(gridSpacing); // Resize it - Fl_Window window(500,500); + Fl_Window window(500, 500); window.add(widget); window.resizable(widget); window.show(); widget->show(); - widget->resize(0,0,500,500); + widget->resize(0, 0, 500, 500); // Show it widget->show(); // Refresh display - if(run) + if (run) { Fl::run(); } diff --git a/Testing/Code/Visualization/otbCurves2DWidgetNew.cxx b/Testing/Code/Visualization/otbCurves2DWidgetNew.cxx index 3e7c9b079f..ff3df4bd05 100644 --- a/Testing/Code/Visualization/otbCurves2DWidgetNew.cxx +++ b/Testing/Code/Visualization/otbCurves2DWidgetNew.cxx @@ -17,13 +17,13 @@ =========================================================================*/ #include "otbCurves2DWidget.h" -int otbCurves2DWidgetNew( int argc, char * argv[] ) +int otbCurves2DWidgetNew(int argc, char * argv[]) { typedef otb::Curves2DWidget WidgetType; WidgetType::Pointer widget = WidgetType::New(); - std::cout<<widget<<std::endl; + std::cout << widget << std::endl; return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbCurves2DWidgetWithHistogram.cxx b/Testing/Code/Visualization/otbCurves2DWidgetWithHistogram.cxx index 0c3e612453..7e25107d60 100644 --- a/Testing/Code/Visualization/otbCurves2DWidgetWithHistogram.cxx +++ b/Testing/Code/Visualization/otbCurves2DWidgetWithHistogram.cxx @@ -26,11 +26,11 @@ #include "otbHistogramCurve.h" -int otbCurves2DWidgetWithHistogram( int argc, char * argv[] ) +int otbCurves2DWidgetWithHistogram(int argc, char * argv[]) { const char * infname = argv[1]; - const bool run = atoi(argv[2]); - + const bool run = atoi(argv[2]); + // typedefs typedef otb::Curves2DWidget WidgetType; typedef WidgetType::PointType PointType; @@ -42,25 +42,25 @@ int otbCurves2DWidgetWithHistogram( int argc, char * argv[] ) typedef VectorImageType::PixelType VectorPixelType; typedef itk::Statistics::ListSample<VectorPixelType> ListSampleType; typedef otb::ListSampleToHistogramListGenerator - <ListSampleType,PixelType> HistogramGeneratorType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef HistogramGeneratorType::HistogramType HistogramType; + <ListSampleType, PixelType> HistogramGeneratorType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef HistogramGeneratorType::HistogramType HistogramType; // Histogram Widget - typedef otb::HistogramCurve<HistogramType> HistogramCurveType; + typedef otb::HistogramCurve<HistogramType> HistogramCurveType; // Instantiation ReaderType::Pointer reader = ReaderType::New(); HistogramGeneratorType::Pointer generator = HistogramGeneratorType::New(); - ListSampleType::Pointer ls = ListSampleType::New(); + ListSampleType::Pointer ls = ListSampleType::New(); // histogram generation reader->SetFileName(infname); reader->Update(); - itk::ImageRegionConstIterator<VectorImageType> it(reader->GetOutput(),reader->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionConstIterator<VectorImageType> it(reader->GetOutput(), reader->GetOutput()->GetLargestPossibleRegion()); - for(it.GoToBegin();!it.IsAtEnd();++it) + for (it.GoToBegin(); !it.IsAtEnd(); ++it) { ls->PushBack(it.Get()); } @@ -68,28 +68,28 @@ int otbCurves2DWidgetWithHistogram( int argc, char * argv[] ) generator->SetListSample(ls); generator->SetNumberOfBins(255); generator->Update(); - - // Create a widget + + // Create a widget WidgetType::Pointer widget = WidgetType::New(); - - HistogramCurveType::ColorType red,green,blue; + + HistogramCurveType::ColorType red, green, blue; red.Fill(0); - red[0]=1.; - red[3]=0.5; + red[0] = 1.; + red[3] = 0.5; green.Fill(0); - green[1]=1.; - green[3]=0.5; + green[1] = 1.; + green[3] = 0.5; blue.Fill(0); - blue[2]=1.; - blue[3]=0.5; + blue[2] = 1.; + blue[3] = 0.5; HistogramCurveType::Pointer rhistogram = HistogramCurveType::New(); rhistogram->SetHistogram(generator->GetOutput()->GetNthElement(0)); rhistogram->SetHistogramColor(red); rhistogram->SetLabelColor(red); - + HistogramCurveType::Pointer ghistogram = HistogramCurveType::New(); ghistogram->SetHistogram(generator->GetOutput()->GetNthElement(1)); ghistogram->SetHistogramColor(green); @@ -105,16 +105,16 @@ int otbCurves2DWidgetWithHistogram( int argc, char * argv[] ) widget->AddCurve(bhistogram); // Resize it - Fl_Window window(500,500); + Fl_Window window(500, 500); window.add(widget); window.resizable(widget); window.show(); widget->show(); - widget->resize(0,0,500,500); + widget->resize(0, 0, 500, 500); // Show it widget->show(); // Refresh display - if(run) + if (run) { Fl::run(); } diff --git a/Testing/Code/Visualization/otbHistogramCurveNew.cxx b/Testing/Code/Visualization/otbHistogramCurveNew.cxx index a68acfdadf..e8f81747ef 100644 --- a/Testing/Code/Visualization/otbHistogramCurveNew.cxx +++ b/Testing/Code/Visualization/otbHistogramCurveNew.cxx @@ -19,12 +19,12 @@ #include "itkHistogram.h" #include "itkDenseFrequencyContainer.h" -int otbHistogramCurveNew( int argc, char * argv[] ) +int otbHistogramCurveNew(int argc, char * argv[]) { - typedef itk::Statistics::Histogram< double,1, - itk::Statistics::DenseFrequencyContainer > HistogramType; - typedef otb::HistogramCurve<HistogramType> HistogramCurveType; - HistogramCurveType::Pointer curve = HistogramCurveType::New(); - + typedef itk::Statistics::Histogram<double, 1, + itk::Statistics::DenseFrequencyContainer> HistogramType; + typedef otb::HistogramCurve<HistogramType> HistogramCurveType; + HistogramCurveType::Pointer curve = HistogramCurveType::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbImageLayerGeneratorNew.cxx b/Testing/Code/Visualization/otbImageLayerGeneratorNew.cxx index fb34f3904b..6794cbe921 100644 --- a/Testing/Code/Visualization/otbImageLayerGeneratorNew.cxx +++ b/Testing/Code/Visualization/otbImageLayerGeneratorNew.cxx @@ -19,12 +19,12 @@ #include "otbImageLayer.h" #include "otbImage.h" -int otbImageLayerGeneratorNew( int argc, char * argv[] ) +int otbImageLayerGeneratorNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::Image<itk::RGBAPixel<unsigned char>, 2 > OutputImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef otb::ImageLayerGenerator<LayerType> GeneratorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::Image<itk::RGBAPixel<unsigned char>, 2> OutputImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageLayerGenerator<LayerType> GeneratorType; GeneratorType::Pointer generator = GeneratorType::New(); diff --git a/Testing/Code/Visualization/otbImageLayerGeneratorScalar.cxx b/Testing/Code/Visualization/otbImageLayerGeneratorScalar.cxx index c3f4538727..23c4625c94 100644 --- a/Testing/Code/Visualization/otbImageLayerGeneratorScalar.cxx +++ b/Testing/Code/Visualization/otbImageLayerGeneratorScalar.cxx @@ -20,23 +20,23 @@ #include "otbImage.h" #include "otbImageFileReader.h" -int otbImageLayerGeneratorScalar( int argc, char * argv[] ) +int otbImageLayerGeneratorScalar(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::Image<itk::RGBAPixel<unsigned char>, 2 > OutputImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef otb::ImageLayerGenerator<LayerType> GeneratorType; + typedef otb::Image<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<itk::RGBAPixel<unsigned char>, 2> OutputImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageLayerGenerator<LayerType> GeneratorType; // Reading input image ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); - + // Generator GeneratorType::Pointer generator = GeneratorType::New(); generator->SetImage(reader->GetOutput()); generator->SetGenerateQuicklook(atoi(argv[2])); - std::cout<<"Advised quicklook susbsampling rate: "<<generator->GetOptimalSubSamplingRate()<<std::endl; + std::cout << "Advised quicklook susbsampling rate: " << generator->GetOptimalSubSamplingRate() << std::endl; generator->GenerateLayer(); return EXIT_SUCCESS; diff --git a/Testing/Code/Visualization/otbImageLayerGeneratorVector.cxx b/Testing/Code/Visualization/otbImageLayerGeneratorVector.cxx index dfcd2a8caa..5e6a3c5015 100644 --- a/Testing/Code/Visualization/otbImageLayerGeneratorVector.cxx +++ b/Testing/Code/Visualization/otbImageLayerGeneratorVector.cxx @@ -20,23 +20,23 @@ #include "otbVectorImage.h" #include "otbImageFileReader.h" -int otbImageLayerGeneratorVector( int argc, char * argv[] ) +int otbImageLayerGeneratorVector(int argc, char * argv[]) { - typedef otb::VectorImage<double,2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::Image<itk::RGBAPixel<unsigned char>, 2 > OutputImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef otb::ImageLayerGenerator<LayerType> GeneratorType; + typedef otb::VectorImage<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::Image<itk::RGBAPixel<unsigned char>, 2> OutputImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageLayerGenerator<LayerType> GeneratorType; // Reading input image ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); - + // Generator GeneratorType::Pointer generator = GeneratorType::New(); generator->SetImage(reader->GetOutput()); generator->SetGenerateQuicklook(atoi(argv[2])); - std::cout<<"Advised quicklook susbsampling rate: "<<generator->GetOptimalSubSamplingRate()<<std::endl; + std::cout << "Advised quicklook susbsampling rate: " << generator->GetOptimalSubSamplingRate() << std::endl; generator->GenerateLayer(); return EXIT_SUCCESS; diff --git a/Testing/Code/Visualization/otbImageLayerNew.cxx b/Testing/Code/Visualization/otbImageLayerNew.cxx index 6cb4119db0..ff9ec097d2 100644 --- a/Testing/Code/Visualization/otbImageLayerNew.cxx +++ b/Testing/Code/Visualization/otbImageLayerNew.cxx @@ -18,11 +18,11 @@ #include "otbImageLayer.h" #include "otbImage.h" -int otbImageLayerNew( int argc, char * argv[] ) +int otbImageLayerNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; - typedef otb::Image<itk::RGBAPixel<unsigned char>, 2 > OutputImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::Image<double, 2> ImageType; + typedef otb::Image<itk::RGBAPixel<unsigned char>, 2> OutputImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; LayerType::Pointer layer = LayerType::New(); diff --git a/Testing/Code/Visualization/otbImageLayerRenderingModelNew.cxx b/Testing/Code/Visualization/otbImageLayerRenderingModelNew.cxx index 657b879432..b3f62aabe4 100644 --- a/Testing/Code/Visualization/otbImageLayerRenderingModelNew.cxx +++ b/Testing/Code/Visualization/otbImageLayerRenderingModelNew.cxx @@ -19,10 +19,10 @@ #include "otbImage.h" #include "itkRGBPixel.h" -int otbImageLayerRenderingModelNew( int argc, char * argv[] ) +int otbImageLayerRenderingModelNew(int argc, char * argv[]) { - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType,2> ImageType; + typedef itk::RGBPixel<unsigned char> RGBPixelType; + typedef otb::Image<RGBPixelType, 2> ImageType; typedef otb::ImageLayerRenderingModel<ImageType> ModelType; // Instantiation diff --git a/Testing/Code/Visualization/otbImageLayerRenderingModelSingleLayer.cxx b/Testing/Code/Visualization/otbImageLayerRenderingModelSingleLayer.cxx index 5e373bfcfd..b19feb59cb 100644 --- a/Testing/Code/Visualization/otbImageLayerRenderingModelSingleLayer.cxx +++ b/Testing/Code/Visualization/otbImageLayerRenderingModelSingleLayer.cxx @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbImageLayer.h" -int otbImageLayerRenderingModelSingleLayer( int argc, char * argv[] ) +int otbImageLayerRenderingModelSingleLayer(int argc, char * argv[]) { // params const char * infname = argv[1]; @@ -33,15 +33,15 @@ int otbImageLayerRenderingModelSingleLayer( int argc, char * argv[] ) const char * sextoutfname = argv[4]; // typedefs - typedef itk::RGBAPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType,2> OutputImageType; - typedef otb::VectorImage<double,2> ImageType; - typedef otb::ImageLayer<ImageType,OutputImageType> LayerType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; - typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef LayerGeneratorType::ResampleFilterType ResampleFilterType; + typedef itk::RGBAPixel<unsigned char> RGBPixelType; + typedef otb::Image<RGBPixelType, 2> OutputImageType; + typedef otb::VectorImage<double, 2> ImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; + typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef LayerGeneratorType::ResampleFilterType ResampleFilterType; // Instantiation ModelType::Pointer model = ModelType::New(); @@ -70,34 +70,33 @@ int otbImageLayerRenderingModelSingleLayer( int argc, char * argv[] ) // Layer manipulation test ModelType::LayerType::Pointer layer = model->GetLayer(0); - std::string layerName = layer->GetName(); + std::string layerName = layer->GetName(); ModelType::LayerType::Pointer layerByName = model->GetLayerByName(layerName); if (layer != layerByName) - { + { return EXIT_FAILURE; - } - + } // Copute extract and scaled extract region - ImageType::RegionType lregion = reader->GetOutput()->GetLargestPossibleRegion(); + ImageType::RegionType lregion = reader->GetOutput()->GetLargestPossibleRegion(); ImageType::RegionType::IndexType index; ImageType::RegionType::SizeType size; - size[0]=100; - size[1]=100; + size[0] = 100; + size[1] = 100; - index[0] = lregion.GetSize()[0]/4; - index[1] = lregion.GetSize()[1]/4; + index[0] = lregion.GetSize()[0] / 4; + index[1] = lregion.GetSize()[1] / 4; ImageType::RegionType extractRegion; extractRegion.SetSize(size); extractRegion.SetIndex(index); - size[0]=25; - size[1]=25; + size[0] = 25; + size[1] = 25; - index[0] = 3 * lregion.GetSize()[0]/8; - index[1] = 3 * lregion.GetSize()[1]/8; + index[0] = 3 * lregion.GetSize()[0] / 8; + index[1] = 3 * lregion.GetSize()[1] / 8; ImageType::RegionType sextractRegion; sextractRegion.SetSize(size); @@ -116,21 +115,21 @@ int otbImageLayerRenderingModelSingleLayer( int argc, char * argv[] ) writer->SetFileName(qloutfname); writer->Update(); - std::cout<<"Quicklook saved."<<std::endl; + std::cout << "Quicklook saved." << std::endl; writer = WriterType::New(); writer->SetInput(model->GetRasterizedExtract()); writer->SetFileName(extoutfname); writer->Update(); - std::cout<<"Extract saved."<<std::endl; + std::cout << "Extract saved." << std::endl; writer = WriterType::New(); writer->SetInput(model->GetRasterizedScaledExtract()); writer->SetFileName(sextoutfname); writer->Update(); - std::cout<<"Scaled extract saved."<<std::endl; + std::cout << "Scaled extract saved." << std::endl; // Layer manipulation test model->DeleteLayerByName(layerName); diff --git a/Testing/Code/Visualization/otbImageLayerScalar.cxx b/Testing/Code/Visualization/otbImageLayerScalar.cxx index 6838d849e3..d14ac1518b 100644 --- a/Testing/Code/Visualization/otbImageLayerScalar.cxx +++ b/Testing/Code/Visualization/otbImageLayerScalar.cxx @@ -22,29 +22,28 @@ #include "otbImageFileReader.h" #include "otbStreamingShrinkImageFilter.h" -int otbImageLayerScalar( int argc, char * argv[] ) +int otbImageLayerScalar(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * qloutfname = argv[2]; - const char * extoutfname = argv[3]; - const char * sextoutfname = argv[4]; + const char * infname = argv[1]; + const char * qloutfname = argv[2]; + const char * extoutfname = argv[3]; + const char * sextoutfname = argv[4]; const unsigned int ssrate = atoi(argv[5]); - const double min = atof(argv[6]); - const double max = atof(argv[7]); + const double min = atof(argv[6]); + const double max = atof(argv[7]); - - typedef otb::Image<double,2> ImageType; - typedef otb::Image<itk::RGBAPixel<unsigned char>, 2 > OutputImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::Image<double, 2> ImageType; + typedef otb::Image<itk::RGBAPixel<unsigned char>, 2> OutputImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; typedef OutputImageType::PixelType OutputPixelType; typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingShrinkImageFilter<ImageType,ImageType> ShrinkFilterType; + typedef otb::StreamingShrinkImageFilter<ImageType, ImageType> ShrinkFilterType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Function::StandardRenderingFunction<double,OutputPixelType> RenderingFunctionType; + typedef otb::Function::StandardRenderingFunction<double, OutputPixelType> RenderingFunctionType; typedef RenderingFunctionType::ParametersType ParametersType; // Instantiation - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ShrinkFilterType::Pointer shrinker = ShrinkFilterType::New(); // Input iamge @@ -76,15 +75,15 @@ int otbImageLayerScalar( int argc, char * argv[] ) function->SetParameters(parameters); layer->SetRenderingFunction(function); - ImageType::RegionType lregion = reader->GetOutput()->GetLargestPossibleRegion(); + ImageType::RegionType lregion = reader->GetOutput()->GetLargestPossibleRegion(); ImageType::RegionType::IndexType index; ImageType::RegionType::SizeType size; - size[0]=100; - size[1]=100; + size[0] = 100; + size[1] = 100; - index[0] = lregion.GetSize()[0]/4; - index[1] = lregion.GetSize()[1]/4; + index[0] = lregion.GetSize()[0] / 4; + index[1] = lregion.GetSize()[1] / 4; ImageType::RegionType extractRegion; extractRegion.SetSize(size); @@ -92,11 +91,11 @@ int otbImageLayerScalar( int argc, char * argv[] ) layer->SetExtractRegion(extractRegion); - size[0]=25; - size[1]=25; + size[0] = 25; + size[1] = 25; - index[0] = 3 * lregion.GetSize()[0]/8; - index[1] = 3 * lregion.GetSize()[1]/8; + index[0] = 3 * lregion.GetSize()[0] / 8; + index[1] = 3 * lregion.GetSize()[1] / 8; ImageType::RegionType sextractRegion; sextractRegion.SetSize(size); @@ -108,7 +107,7 @@ int otbImageLayerScalar( int argc, char * argv[] ) layer->Render(); // Report a pixel - std::cout<<"Reporting index: "<<index<<" -> "<<layer->GetPixelDescription(index)<<std::endl; + std::cout << "Reporting index: " << index << " -> " << layer->GetPixelDescription(index) << std::endl; // Write the image views WriterType::Pointer writer = WriterType::New(); diff --git a/Testing/Code/Visualization/otbImageLayerVector.cxx b/Testing/Code/Visualization/otbImageLayerVector.cxx index 0fff055e0b..04ab0b7ca1 100644 --- a/Testing/Code/Visualization/otbImageLayerVector.cxx +++ b/Testing/Code/Visualization/otbImageLayerVector.cxx @@ -23,28 +23,28 @@ #include "otbImageFileReader.h" #include "otbStreamingShrinkImageFilter.h" -int otbImageLayerVector( int argc, char * argv[] ) +int otbImageLayerVector(int argc, char * argv[]) { - const char * infname = argv[1]; - const char * qloutfname = argv[2]; - const char * extoutfname = argv[3]; - const char * sextoutfname = argv[4]; + const char * infname = argv[1]; + const char * qloutfname = argv[2]; + const char * extoutfname = argv[3]; + const char * sextoutfname = argv[4]; const unsigned int ssrate = atoi(argv[5]); - typedef double ScalarType; - typedef otb::VectorImage<ScalarType,2> ImageType; - typedef ImageType::PixelType VectorPixelType; - typedef otb::Image<itk::RGBAPixel<unsigned char>, 2 > OutputImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef OutputImageType::PixelType OutputPixelType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingShrinkImageFilter<ImageType,ImageType> ShrinkFilterType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::Function::StandardRenderingFunction<VectorPixelType,OutputPixelType> RenderingFunctionType; - typedef RenderingFunctionType::ParametersType ParametersType; + typedef double ScalarType; + typedef otb::VectorImage<ScalarType, 2> ImageType; + typedef ImageType::PixelType VectorPixelType; + typedef otb::Image<itk::RGBAPixel<unsigned char>, 2> OutputImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef OutputImageType::PixelType OutputPixelType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingShrinkImageFilter<ImageType, ImageType> ShrinkFilterType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::Function::StandardRenderingFunction<VectorPixelType, OutputPixelType> RenderingFunctionType; + typedef RenderingFunctionType::ParametersType ParametersType; // Instantiation - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); ShrinkFilterType::Pointer shrinker = ShrinkFilterType::New(); // Input iamge @@ -54,14 +54,13 @@ int otbImageLayerVector( int argc, char * argv[] ) unsigned int nbComponents = reader->GetOutput()->GetNumberOfComponentsPerPixel(); // min & max - ParametersType parameters(2*nbComponents); - for(unsigned int i = 0; i<parameters.Size();++i) - { - parameters[i]=atof(argv[6+i]); + ParametersType parameters(2 * nbComponents); + for (unsigned int i = 0; i < parameters.Size(); ++i) + { + parameters[i] = atof(argv[6 + i]); ++i; - parameters[i]=atof(argv[6+i]); - } - + parameters[i] = atof(argv[6 + i]); + } // Quicklook shrinker->SetInput(reader->GetOutput()); @@ -84,15 +83,15 @@ int otbImageLayerVector( int argc, char * argv[] ) function->SetParameters(parameters); layer->SetRenderingFunction(function); - ImageType::RegionType lregion = reader->GetOutput()->GetLargestPossibleRegion(); + ImageType::RegionType lregion = reader->GetOutput()->GetLargestPossibleRegion(); ImageType::RegionType::IndexType index; ImageType::RegionType::SizeType size; - size[0]=100; - size[1]=100; + size[0] = 100; + size[1] = 100; - index[0] = lregion.GetSize()[0]/4; - index[1] = lregion.GetSize()[1]/4; + index[0] = lregion.GetSize()[0] / 4; + index[1] = lregion.GetSize()[1] / 4; ImageType::RegionType extractRegion; extractRegion.SetSize(size); @@ -100,11 +99,11 @@ int otbImageLayerVector( int argc, char * argv[] ) layer->SetExtractRegion(extractRegion); - size[0]=25; - size[1]=25; + size[0] = 25; + size[1] = 25; - index[0] = 3 * lregion.GetSize()[0]/8; - index[1] = 3 * lregion.GetSize()[1]/8; + index[0] = 3 * lregion.GetSize()[0] / 8; + index[1] = 3 * lregion.GetSize()[1] / 8; ImageType::RegionType sextractRegion; sextractRegion.SetSize(size); @@ -116,7 +115,7 @@ int otbImageLayerVector( int argc, char * argv[] ) layer->Render(); // Report a pixel - std::cout<<"Reporting index: "<<index<<" -> "<<layer->GetPixelDescription(index)<<std::endl; + std::cout << "Reporting index: " << index << " -> " << layer->GetPixelDescription(index) << std::endl; // Write the image views WriterType::Pointer writer = WriterType::New(); diff --git a/Testing/Code/Visualization/otbImageViewNew.cxx b/Testing/Code/Visualization/otbImageViewNew.cxx index 9d8dd3c5bc..887ee6b6de 100644 --- a/Testing/Code/Visualization/otbImageViewNew.cxx +++ b/Testing/Code/Visualization/otbImageViewNew.cxx @@ -20,12 +20,12 @@ #include "itkRGBPixel.h" #include "otbImageView.h" -int otbImageViewNew( int argc, char * argv[] ) +int otbImageViewNew(int argc, char * argv[]) { - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType,2> ImageType; + typedef itk::RGBPixel<unsigned char> RGBPixelType; + typedef otb::Image<RGBPixelType, 2> ImageType; typedef otb::ImageLayerRenderingModel<ImageType> ModelType; - typedef otb::ImageView<ModelType> ViewType; + typedef otb::ImageView<ModelType> ViewType; // Instantiation ViewType::Pointer model = ViewType::New(); diff --git a/Testing/Code/Visualization/otbImageViewerEndToEndSingleLayer.cxx b/Testing/Code/Visualization/otbImageViewerEndToEndSingleLayer.cxx index 361974b8bb..e276246f65 100644 --- a/Testing/Code/Visualization/otbImageViewerEndToEndSingleLayer.cxx +++ b/Testing/Code/Visualization/otbImageViewerEndToEndSingleLayer.cxx @@ -33,59 +33,56 @@ #include "otbPixelDescriptionActionHandler.h" #include "otbPixelDescriptionView.h" -int otbImageViewerEndToEndSingleLayer( int argc, char * argv[] ) +int otbImageViewerEndToEndSingleLayer(int argc, char * argv[]) { // params - const char * infname = argv[1]; + const char * infname = argv[1]; const unsigned int scrollSize = atoi(argv[2]); const unsigned int fullSize = atoi(argv[3]); const unsigned int zoomSize = atoi(argv[4]); const double run = atoi(argv[5]); - // typedefs - typedef double PixelType; - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType,2> OutputImageType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; - typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; - typedef otb::ImageView<ModelType> ViewType; - typedef otb::ImageWidgetController ControllerType; + typedef double PixelType; + typedef itk::RGBPixel<unsigned char> RGBPixelType; + typedef otb::Image<RGBPixelType, 2> OutputImageType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; + typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; + typedef otb::ImageView<ModelType> ViewType; + typedef otb::ImageWidgetController ControllerType; typedef otb::WidgetResizingActionHandler - <ModelType,ViewType> ResizingHandlerType; + <ModelType, ViewType> ResizingHandlerType; typedef otb::ChangeScaledExtractRegionActionHandler - <ModelType,ViewType> ChangeScaledRegionHandlerType; + <ModelType, ViewType> ChangeScaledRegionHandlerType; typedef otb::ChangeExtractRegionActionHandler - <ModelType,ViewType> ChangeRegionHandlerType; + <ModelType, ViewType> ChangeRegionHandlerType; typedef otb::ChangeScaleActionHandler - <ModelType,ViewType> ChangeScaleHandlerType; + <ModelType, ViewType> ChangeScaleHandlerType; typedef otb::PixelDescriptionModel<OutputImageType> PixelDescriptionModelType; typedef otb::PixelDescriptionActionHandler - < PixelDescriptionModelType, ViewType> PixelDescriptionActionHandlerType; + <PixelDescriptionModelType, ViewType> PixelDescriptionActionHandlerType; typedef otb::PixelDescriptionView - < PixelDescriptionModelType > PixelDescriptionViewType; - + <PixelDescriptionModelType> PixelDescriptionViewType; // Instantiation - ModelType::Pointer model = ModelType::New(); + ModelType::Pointer model = ModelType::New(); PixelDescriptionModelType::Pointer pixelModel = PixelDescriptionModelType::New(); pixelModel->SetLayers(model->GetLayers()); // Reading input image ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); - + // Generate the layer LayerGeneratorType::Pointer generator = LayerGeneratorType::New(); generator->SetImage(reader->GetOutput()); generator->GenerateLayer(); - - // Add the layer to the model + + // Add the layer to the model model->AddLayer(generator->GetLayer()); - // Build a view ViewType::Pointer view = ViewType::New(); @@ -102,19 +99,19 @@ int otbImageViewerEndToEndSingleLayer( int argc, char * argv[] ) controller->AddActionHandler(resizingHandler); // Add the change scaled region handler - ChangeScaledRegionHandlerType::Pointer changeScaledHandler =ChangeScaledRegionHandlerType::New(); + ChangeScaledRegionHandlerType::Pointer changeScaledHandler = ChangeScaledRegionHandlerType::New(); changeScaledHandler->SetModel(model); changeScaledHandler->SetView(view); controller->AddActionHandler(changeScaledHandler); // Add the change extract region handler - ChangeRegionHandlerType::Pointer changeHandler =ChangeRegionHandlerType::New(); + ChangeRegionHandlerType::Pointer changeHandler = ChangeRegionHandlerType::New(); changeHandler->SetModel(model); changeHandler->SetView(view); controller->AddActionHandler(changeHandler); // Add the change scaled handler - ChangeScaleHandlerType::Pointer changeScaleHandler =ChangeScaleHandlerType::New(); + ChangeScaleHandlerType::Pointer changeScaleHandler = ChangeScaleHandlerType::New(); changeScaleHandler->SetModel(model); changeScaleHandler->SetView(view); controller->AddActionHandler(changeScaleHandler); @@ -129,47 +126,47 @@ int otbImageViewerEndToEndSingleLayer( int argc, char * argv[] ) PixelDescriptionViewType::Pointer pixelView = PixelDescriptionViewType::New(); pixelView->SetModel(pixelModel); - Fl_Window pixelWindow(fullSize,50); - if(fullSize > 0) + Fl_Window pixelWindow(fullSize, 50); + if (fullSize > 0) { pixelWindow.add(pixelView->GetPixelDescriptionWidget()); pixelWindow.resizable(pixelView->GetPixelDescriptionWidget()); pixelWindow.show(); pixelView->GetPixelDescriptionWidget()->show(); - pixelView->GetPixelDescriptionWidget()->resize(0,0,fullSize,50); + pixelView->GetPixelDescriptionWidget()->resize(0, 0, fullSize, 50); } - Fl_Window scrollWindow(scrollSize,scrollSize); - if(scrollSize > 0) + Fl_Window scrollWindow(scrollSize, scrollSize); + if (scrollSize > 0) { - scrollWindow.add(view->GetScrollWidget()); - scrollWindow.resizable(view->GetScrollWidget()); - scrollWindow.show(); + scrollWindow.add(view->GetScrollWidget()); + scrollWindow.resizable(view->GetScrollWidget()); + scrollWindow.show(); view->GetScrollWidget()->show(); - view->GetScrollWidget()->resize(0,0,scrollSize,scrollSize); + view->GetScrollWidget()->resize(0, 0, scrollSize, scrollSize); } - Fl_Window fullWindow(fullSize,fullSize); - if(fullSize > 0) + Fl_Window fullWindow(fullSize, fullSize); + if (fullSize > 0) { fullWindow.add(view->GetFullWidget()); fullWindow.resizable(view->GetFullWidget()); fullWindow.show(); view->GetFullWidget()->show(); - view->GetFullWidget()->resize(0,0,fullSize,fullSize); + view->GetFullWidget()->resize(0, 0, fullSize, fullSize); } - Fl_Window zoomWindow(zoomSize,zoomSize); - if(zoomSize > 0) + Fl_Window zoomWindow(zoomSize, zoomSize); + if (zoomSize > 0) { zoomWindow.add(view->GetZoomWidget()); zoomWindow.resizable(view->GetZoomWidget()); zoomWindow.show(); view->GetZoomWidget()->show(); - view->GetZoomWidget()->resize(0,0,zoomSize,zoomSize); + view->GetZoomWidget()->resize(0, 0, zoomSize, zoomSize); } - if(run) + if (run) { Fl::run(); } diff --git a/Testing/Code/Visualization/otbImageViewerEndToEndSingleLayerWithSelectAreaHandler.cxx b/Testing/Code/Visualization/otbImageViewerEndToEndSingleLayerWithSelectAreaHandler.cxx index f7e54340ef..7a68d75235 100644 --- a/Testing/Code/Visualization/otbImageViewerEndToEndSingleLayerWithSelectAreaHandler.cxx +++ b/Testing/Code/Visualization/otbImageViewerEndToEndSingleLayerWithSelectAreaHandler.cxx @@ -34,57 +34,56 @@ #include "otbPixelDescriptionActionHandler.h" #include "otbPixelDescriptionView.h" -int otbImageViewerEndToEndSingleLayerWithSelectAreaHandler( int argc, char * argv[] ) +int otbImageViewerEndToEndSingleLayerWithSelectAreaHandler(int argc, char * argv[]) { // params - const char * infname = argv[1]; + const char * infname = argv[1]; const unsigned int scrollSize = atoi(argv[2]); const unsigned int fullSize = atoi(argv[3]); const unsigned int zoomSize = atoi(argv[4]); const double run = atoi(argv[5]); // typedefs - typedef double PixelType; - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType,2> OutputImageType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; - typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; - typedef otb::ImageView<ModelType> ViewType; - typedef otb::ImageWidgetController ControllerType; + typedef double PixelType; + typedef itk::RGBPixel<unsigned char> RGBPixelType; + typedef otb::Image<RGBPixelType, 2> OutputImageType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; + typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; + typedef otb::ImageView<ModelType> ViewType; + typedef otb::ImageWidgetController ControllerType; typedef otb::WidgetResizingActionHandler - <ModelType,ViewType> ResizingHandlerType; + <ModelType, ViewType> ResizingHandlerType; typedef otb::ChangeScaledExtractRegionActionHandler - <ModelType,ViewType> ChangeScaledRegionHandlerType; + <ModelType, ViewType> ChangeScaledRegionHandlerType; typedef otb::ChangeScaleActionHandler - <ModelType,ViewType> ChangeScaleHandlerType; + <ModelType, ViewType> ChangeScaleHandlerType; typedef otb::PixelDescriptionModel<OutputImageType> PixelDescriptionModelType; typedef otb::PixelDescriptionActionHandler - < PixelDescriptionModelType, ViewType> PixelDescriptionActionHandlerType; + <PixelDescriptionModelType, ViewType> PixelDescriptionActionHandlerType; typedef otb::PixelDescriptionView - < PixelDescriptionModelType > PixelDescriptionViewType; + <PixelDescriptionModelType> PixelDescriptionViewType; typedef otb::SelectAreaActionHandler - <ModelType,ViewType::ImageWidgetType> ChangeRegionHandlerType; - + <ModelType, ViewType::ImageWidgetType> ChangeRegionHandlerType; + // Instantiation - ModelType::Pointer model = ModelType::New(); + ModelType::Pointer model = ModelType::New(); PixelDescriptionModelType::Pointer pixelModel = PixelDescriptionModelType::New(); pixelModel->SetLayers(model->GetLayers()); // Reading input image ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); - + // Generate the layer LayerGeneratorType::Pointer generator = LayerGeneratorType::New(); generator->SetImage(reader->GetOutput()); generator->GenerateLayer(); - - // Add the layer to the model + + // Add the layer to the model model->AddLayer(generator->GetLayer()); - // Build a view ViewType::Pointer view = ViewType::New(); @@ -101,7 +100,7 @@ int otbImageViewerEndToEndSingleLayerWithSelectAreaHandler( int argc, char * arg controller->AddActionHandler(resizingHandler); // Add the change scaled region handler - ChangeScaledRegionHandlerType::Pointer changeScaledHandler =ChangeScaledRegionHandlerType::New(); + ChangeScaledRegionHandlerType::Pointer changeScaledHandler = ChangeScaledRegionHandlerType::New(); changeScaledHandler->SetModel(model); changeScaledHandler->SetView(view); controller->AddActionHandler(changeScaledHandler); @@ -113,66 +112,63 @@ int otbImageViewerEndToEndSingleLayerWithSelectAreaHandler( int argc, char * arg controller->AddActionHandler(pixelActionHandler); // Add the change scaled handler - ChangeScaleHandlerType::Pointer changeScaleHandler =ChangeScaleHandlerType::New(); + ChangeScaleHandlerType::Pointer changeScaleHandler = ChangeScaleHandlerType::New(); changeScaleHandler->SetModel(model); changeScaleHandler->SetView(view); controller->AddActionHandler(changeScaleHandler); - - // Add the change extract region handler - ChangeRegionHandlerType::Pointer changeHandler =ChangeRegionHandlerType::New(); - changeHandler->SetModel( model ); - changeHandler->SetWidget( view->GetScrollWidget() ); - changeHandler->SetRegionGlComponent( view->GetExtractRegionGlComponent() ); + // Add the change extract region handler + ChangeRegionHandlerType::Pointer changeHandler = ChangeRegionHandlerType::New(); + changeHandler->SetModel(model); + changeHandler->SetWidget(view->GetScrollWidget()); + changeHandler->SetRegionGlComponent(view->GetExtractRegionGlComponent()); controller->AddActionHandler(changeHandler); - - // Build a pixel description view PixelDescriptionViewType::Pointer pixelView = PixelDescriptionViewType::New(); pixelView->SetModel(pixelModel); - Fl_Window pixelWindow(fullSize,50); - if(fullSize > 0) + Fl_Window pixelWindow(fullSize, 50); + if (fullSize > 0) { pixelWindow.add(pixelView->GetPixelDescriptionWidget()); pixelWindow.resizable(pixelView->GetPixelDescriptionWidget()); pixelWindow.show(); pixelView->GetPixelDescriptionWidget()->show(); - pixelView->GetPixelDescriptionWidget()->resize(0,0,fullSize,50); + pixelView->GetPixelDescriptionWidget()->resize(0, 0, fullSize, 50); } - Fl_Window scrollWindow(scrollSize,scrollSize); - if(scrollSize > 0) + Fl_Window scrollWindow(scrollSize, scrollSize); + if (scrollSize > 0) { - scrollWindow.add(view->GetScrollWidget()); - scrollWindow.resizable(view->GetScrollWidget()); - scrollWindow.show(); + scrollWindow.add(view->GetScrollWidget()); + scrollWindow.resizable(view->GetScrollWidget()); + scrollWindow.show(); view->GetScrollWidget()->show(); - view->GetScrollWidget()->resize(0,0,scrollSize,scrollSize); + view->GetScrollWidget()->resize(0, 0, scrollSize, scrollSize); } - Fl_Window fullWindow(fullSize,fullSize); - if(fullSize > 0) + Fl_Window fullWindow(fullSize, fullSize); + if (fullSize > 0) { fullWindow.add(view->GetFullWidget()); fullWindow.resizable(view->GetFullWidget()); fullWindow.show(); view->GetFullWidget()->show(); - view->GetFullWidget()->resize(0,0,fullSize,fullSize); + view->GetFullWidget()->resize(0, 0, fullSize, fullSize); } - Fl_Window zoomWindow(zoomSize,zoomSize); - if(zoomSize > 0) + Fl_Window zoomWindow(zoomSize, zoomSize); + if (zoomSize > 0) { zoomWindow.add(view->GetZoomWidget()); zoomWindow.resizable(view->GetZoomWidget()); zoomWindow.show(); view->GetZoomWidget()->show(); - view->GetZoomWidget()->resize(0,0,zoomSize,zoomSize); + view->GetZoomWidget()->resize(0, 0, zoomSize, zoomSize); } - if(run) + if (run) { Fl::run(); } diff --git a/Testing/Code/Visualization/otbImageViewerEndToEndTwoLayers.cxx b/Testing/Code/Visualization/otbImageViewerEndToEndTwoLayers.cxx index 9b0d133cc4..3a4f0e85be 100644 --- a/Testing/Code/Visualization/otbImageViewerEndToEndTwoLayers.cxx +++ b/Testing/Code/Visualization/otbImageViewerEndToEndTwoLayers.cxx @@ -35,62 +35,61 @@ #include "otbPixelDescriptionActionHandler.h" #include "otbPixelDescriptionView.h" -int otbImageViewerEndToEndTwoLayers( int argc, char * argv[] ) +int otbImageViewerEndToEndTwoLayers(int argc, char * argv[]) { // params - const char * infname = argv[1]; + const char * infname = argv[1]; const unsigned int scrollSize = atoi(argv[2]); const unsigned int fullSize = atoi(argv[3]); const unsigned int zoomSize = atoi(argv[4]); const double run = atoi(argv[5]); - // typedefs - typedef double PixelType; - typedef itk::RGBAPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType,2> OutputImageType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef otb::Image<PixelType,2> ScalarImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; - typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; - typedef otb::ImageView<ModelType> ViewType; - typedef otb::ImageWidgetController ControllerType; + typedef double PixelType; + typedef itk::RGBAPixel<unsigned char> RGBPixelType; + typedef otb::Image<RGBPixelType, 2> OutputImageType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef otb::Image<PixelType, 2> ScalarImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; + typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; + typedef otb::ImageView<ModelType> ViewType; + typedef otb::ImageWidgetController ControllerType; typedef otb::WidgetResizingActionHandler - <ModelType,ViewType> ResizingHandlerType; + <ModelType, ViewType> ResizingHandlerType; typedef otb::ChangeScaledExtractRegionActionHandler - <ModelType,ViewType> ChangeScaledRegionHandlerType; + <ModelType, ViewType> ChangeScaledRegionHandlerType; typedef otb::ChangeExtractRegionActionHandler - <ModelType,ViewType> ChangeRegionHandlerType; + <ModelType, ViewType> ChangeRegionHandlerType; typedef otb::ChangeScaleActionHandler - <ModelType,ViewType> ChangeScaleHandlerType; + <ModelType, ViewType> ChangeScaleHandlerType; typedef otb::PixelDescriptionModel<OutputImageType> PixelDescriptionModelType; typedef otb::PixelDescriptionActionHandler - < PixelDescriptionModelType, ViewType> PixelDescriptionActionHandlerType; + <PixelDescriptionModelType, ViewType> PixelDescriptionActionHandlerType; typedef otb::PixelDescriptionView - < PixelDescriptionModelType > PixelDescriptionViewType; + <PixelDescriptionModelType> PixelDescriptionViewType; // Filters for the second layer - typedef itk::SobelEdgeDetectionImageFilter<ScalarImageType,ScalarImageType> FilterType; - typedef otb::PerBandVectorImageFilter<ImageType,ImageType,FilterType> + typedef itk::SobelEdgeDetectionImageFilter<ScalarImageType, ScalarImageType> FilterType; + typedef otb::PerBandVectorImageFilter<ImageType, ImageType, FilterType> PerBandFilterType; // Instantiation - ModelType::Pointer model = ModelType::New(); + ModelType::Pointer model = ModelType::New(); PixelDescriptionModelType::Pointer pixelModel = PixelDescriptionModelType::New(); pixelModel->SetLayers(model->GetLayers()); // Reading input image ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); - + // Generate the first layer LayerGeneratorType::Pointer generator = LayerGeneratorType::New(); generator->SetImage(reader->GetOutput()); generator->GenerateLayer(); generator->GetLayer()->SetName("Image"); - + // Generate the second layer PerBandFilterType::Pointer filter = PerBandFilterType::New(); filter->SetInput(reader->GetOutput()); @@ -99,11 +98,11 @@ int otbImageViewerEndToEndTwoLayers( int argc, char * argv[] ) generator2->SetImage(filter->GetOutput()); generator2->GenerateLayer(); generator2->GetLayer()->SetName("Gradient"); - - // Add the layer to the model + + // Add the layer to the model model->AddLayer(generator->GetLayer()); model->AddLayer(generator2->GetLayer()); - + // Build a view ViewType::Pointer view = ViewType::New(); view->SetModel(model); @@ -119,19 +118,19 @@ int otbImageViewerEndToEndTwoLayers( int argc, char * argv[] ) controller->AddActionHandler(resizingHandler); // Add the change scaled region handler - ChangeScaledRegionHandlerType::Pointer changeScaledHandler =ChangeScaledRegionHandlerType::New(); + ChangeScaledRegionHandlerType::Pointer changeScaledHandler = ChangeScaledRegionHandlerType::New(); changeScaledHandler->SetModel(model); changeScaledHandler->SetView(view); controller->AddActionHandler(changeScaledHandler); // Add the change extract region handler - ChangeRegionHandlerType::Pointer changeHandler =ChangeRegionHandlerType::New(); + ChangeRegionHandlerType::Pointer changeHandler = ChangeRegionHandlerType::New(); changeHandler->SetModel(model); changeHandler->SetView(view); controller->AddActionHandler(changeHandler); // Add the change scaled handler - ChangeScaleHandlerType::Pointer changeScaleHandler =ChangeScaleHandlerType::New(); + ChangeScaleHandlerType::Pointer changeScaleHandler = ChangeScaleHandlerType::New(); changeScaleHandler->SetModel(model); changeScaleHandler->SetView(view); controller->AddActionHandler(changeScaleHandler); @@ -141,52 +140,52 @@ int otbImageViewerEndToEndTwoLayers( int argc, char * argv[] ) pixelActionHandler->SetView(view); pixelActionHandler->SetModel(pixelModel); controller->AddActionHandler(pixelActionHandler); - + // Build a pixel description view PixelDescriptionViewType::Pointer pixelView = PixelDescriptionViewType::New(); pixelView->SetModel(pixelModel); - - Fl_Window pixelWindow(fullSize,50); - if(fullSize > 0) + + Fl_Window pixelWindow(fullSize, 50); + if (fullSize > 0) { pixelWindow.add(pixelView->GetPixelDescriptionWidget()); pixelWindow.resizable(pixelView->GetPixelDescriptionWidget()); pixelWindow.show(); pixelView->GetPixelDescriptionWidget()->show(); - pixelView->GetPixelDescriptionWidget()->resize(0,0,fullSize,50); + pixelView->GetPixelDescriptionWidget()->resize(0, 0, fullSize, 50); } - Fl_Window scrollWindow(scrollSize,scrollSize); - if(scrollSize > 0) + Fl_Window scrollWindow(scrollSize, scrollSize); + if (scrollSize > 0) { - scrollWindow.add(view->GetScrollWidget()); - scrollWindow.resizable(view->GetScrollWidget()); - scrollWindow.show(); + scrollWindow.add(view->GetScrollWidget()); + scrollWindow.resizable(view->GetScrollWidget()); + scrollWindow.show(); view->GetScrollWidget()->show(); - view->GetScrollWidget()->resize(0,0,scrollSize,scrollSize); + view->GetScrollWidget()->resize(0, 0, scrollSize, scrollSize); } - Fl_Window fullWindow(fullSize,fullSize); - if(fullSize > 0) + Fl_Window fullWindow(fullSize, fullSize); + if (fullSize > 0) { fullWindow.add(view->GetFullWidget()); fullWindow.resizable(view->GetFullWidget()); fullWindow.show(); view->GetFullWidget()->show(); - view->GetFullWidget()->resize(0,0,fullSize,fullSize); + view->GetFullWidget()->resize(0, 0, fullSize, fullSize); } - Fl_Window zoomWindow(zoomSize,zoomSize); - if(zoomSize > 0) + Fl_Window zoomWindow(zoomSize, zoomSize); + if (zoomSize > 0) { zoomWindow.add(view->GetZoomWidget()); zoomWindow.resizable(view->GetZoomWidget()); zoomWindow.show(); view->GetZoomWidget()->show(); - view->GetZoomWidget()->resize(0,0,zoomSize,zoomSize); + view->GetZoomWidget()->resize(0, 0, zoomSize, zoomSize); } - if(run) + if (run) { Fl::run(); } @@ -199,6 +198,6 @@ int otbImageViewerEndToEndTwoLayers( int argc, char * argv[] ) scrollWindow.remove(view->GetScrollWidget()); fullWindow.remove(view->GetFullWidget()); pixelWindow.remove(pixelView->GetPixelDescriptionWidget()); - + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbImageViewerEndToEndWithVectorData.cxx b/Testing/Code/Visualization/otbImageViewerEndToEndWithVectorData.cxx index 39822f901b..4dd732f38b 100644 --- a/Testing/Code/Visualization/otbImageViewerEndToEndWithVectorData.cxx +++ b/Testing/Code/Visualization/otbImageViewerEndToEndWithVectorData.cxx @@ -39,53 +39,52 @@ #include "otbVectorDataProjectionFilter.h" #include "otbVectorDataGlComponent.h" - -int otbImageViewerEndToEndWithVectorData( int argc, char * argv[] ) +int otbImageViewerEndToEndWithVectorData(int argc, char * argv[]) { // params - const char * infname = argv[1]; - const char * vinfname = argv[2]; - const char * demdir = argv[3]; + const char * infname = argv[1]; + const char * vinfname = argv[2]; + const char * demdir = argv[3]; const unsigned int scrollSize = atoi(argv[4]); const unsigned int fullSize = atoi(argv[5]); const unsigned int zoomSize = atoi(argv[6]); const double run = atoi(argv[7]); - // typedefs - typedef double PixelType; - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType,2> OutputImageType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; - typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; - typedef otb::ImageView<ModelType> ViewType; - typedef otb::ImageWidgetController ControllerType; + typedef double PixelType; + typedef itk::RGBPixel<unsigned char> RGBPixelType; + typedef otb::Image<RGBPixelType, 2> OutputImageType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; + typedef otb::ImageLayerRenderingModel<OutputImageType> ModelType; + typedef otb::ImageView<ModelType> ViewType; + typedef otb::ImageWidgetController ControllerType; typedef otb::WidgetResizingActionHandler - <ModelType,ViewType> ResizingHandlerType; + <ModelType, ViewType> ResizingHandlerType; typedef otb::ChangeScaledExtractRegionActionHandler - <ModelType,ViewType> ChangeScaledRegionHandlerType; + <ModelType, ViewType> ChangeScaledRegionHandlerType; typedef otb::ChangeExtractRegionActionHandler - <ModelType,ViewType> ChangeRegionHandlerType; + <ModelType, ViewType> ChangeRegionHandlerType; typedef otb::ChangeScaleActionHandler - <ModelType,ViewType> ChangeScaleHandlerType; + <ModelType, ViewType> ChangeScaleHandlerType; typedef otb::PixelDescriptionModel<OutputImageType> PixelDescriptionModelType; typedef otb::PixelDescriptionActionHandler - < PixelDescriptionModelType, ViewType> PixelDescriptionActionHandlerType; + <PixelDescriptionModelType, ViewType> PixelDescriptionActionHandlerType; typedef otb::PixelDescriptionView - < PixelDescriptionModelType > PixelDescriptionViewType; + <PixelDescriptionModelType> PixelDescriptionViewType; // VectorData - typedef otb::VectorData<double> VectorDataType; - typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; + typedef otb::VectorData<double> VectorDataType; + typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; typedef otb::VectorDataProjectionFilter<VectorDataType, - VectorDataType> VectorDataProjectionFilterType; - typedef otb::VectorDataGlComponent<VectorDataType> VectorDataGlComponentType; + VectorDataType> + VectorDataProjectionFilterType; + typedef otb::VectorDataGlComponent<VectorDataType> VectorDataGlComponentType; // Instantiation - ModelType::Pointer model = ModelType::New(); + ModelType::Pointer model = ModelType::New(); PixelDescriptionModelType::Pointer pixelModel = PixelDescriptionModelType::New(); pixelModel->SetLayers(model->GetLayers()); @@ -93,12 +92,12 @@ int otbImageViewerEndToEndWithVectorData( int argc, char * argv[] ) ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); reader->GenerateOutputInformation(); - + // /// Prepare the VectorData VectorDataFileReaderType::Pointer vreader = VectorDataFileReaderType::New(); vreader->SetFileName(vinfname); vreader->UpdateOutputInformation(); - + VectorDataProjectionFilterType::Pointer vproj = VectorDataProjectionFilterType::New(); vproj->SetInput(vreader->GetOutput()); vproj->SetOutputKeywordList(reader->GetOutput()->GetImageKeywordlist()); @@ -114,10 +113,10 @@ int otbImageViewerEndToEndWithVectorData( int argc, char * argv[] ) LayerGeneratorType::Pointer generator = LayerGeneratorType::New(); generator->SetImage(reader->GetOutput()); generator->GenerateLayer(); - - // Add the layer to the model + + // Add the layer to the model model->AddLayer(generator->GetLayer()); - + // Build a view ViewType::Pointer view = ViewType::New(); view->SetModel(model); @@ -137,19 +136,19 @@ int otbImageViewerEndToEndWithVectorData( int argc, char * argv[] ) controller->AddActionHandler(resizingHandler); // Add the change scaled region handler - ChangeScaledRegionHandlerType::Pointer changeScaledHandler =ChangeScaledRegionHandlerType::New(); + ChangeScaledRegionHandlerType::Pointer changeScaledHandler = ChangeScaledRegionHandlerType::New(); changeScaledHandler->SetModel(model); changeScaledHandler->SetView(view); controller->AddActionHandler(changeScaledHandler); // Add the change extract region handler - ChangeRegionHandlerType::Pointer changeHandler =ChangeRegionHandlerType::New(); + ChangeRegionHandlerType::Pointer changeHandler = ChangeRegionHandlerType::New(); changeHandler->SetModel(model); changeHandler->SetView(view); controller->AddActionHandler(changeHandler); // Add the change scaled handler - ChangeScaleHandlerType::Pointer changeScaleHandler =ChangeScaleHandlerType::New(); + ChangeScaleHandlerType::Pointer changeScaleHandler = ChangeScaleHandlerType::New(); changeScaleHandler->SetModel(model); changeScaleHandler->SetView(view); controller->AddActionHandler(changeScaleHandler); @@ -164,47 +163,47 @@ int otbImageViewerEndToEndWithVectorData( int argc, char * argv[] ) PixelDescriptionViewType::Pointer pixelView = PixelDescriptionViewType::New(); pixelView->SetModel(pixelModel); - Fl_Window pixelWindow(fullSize,50); - if(fullSize > 0) + Fl_Window pixelWindow(fullSize, 50); + if (fullSize > 0) { pixelWindow.add(pixelView->GetPixelDescriptionWidget()); pixelWindow.resizable(pixelView->GetPixelDescriptionWidget()); pixelWindow.show(); pixelView->GetPixelDescriptionWidget()->show(); - pixelView->GetPixelDescriptionWidget()->resize(0,0,fullSize,50); + pixelView->GetPixelDescriptionWidget()->resize(0, 0, fullSize, 50); } - Fl_Window scrollWindow(scrollSize,scrollSize); - if(scrollSize > 0) + Fl_Window scrollWindow(scrollSize, scrollSize); + if (scrollSize > 0) { - scrollWindow.add(view->GetScrollWidget()); - scrollWindow.resizable(view->GetScrollWidget()); - scrollWindow.show(); + scrollWindow.add(view->GetScrollWidget()); + scrollWindow.resizable(view->GetScrollWidget()); + scrollWindow.show(); view->GetScrollWidget()->show(); - view->GetScrollWidget()->resize(0,0,scrollSize,scrollSize); + view->GetScrollWidget()->resize(0, 0, scrollSize, scrollSize); } - Fl_Window fullWindow(fullSize,fullSize); - if(fullSize > 0) + Fl_Window fullWindow(fullSize, fullSize); + if (fullSize > 0) { fullWindow.add(view->GetFullWidget()); fullWindow.resizable(view->GetFullWidget()); fullWindow.show(); view->GetFullWidget()->show(); - view->GetFullWidget()->resize(0,0,fullSize,fullSize); + view->GetFullWidget()->resize(0, 0, fullSize, fullSize); } - Fl_Window zoomWindow(zoomSize,zoomSize); - if(zoomSize > 0) + Fl_Window zoomWindow(zoomSize, zoomSize); + if (zoomSize > 0) { zoomWindow.add(view->GetZoomWidget()); zoomWindow.resizable(view->GetZoomWidget()); zoomWindow.show(); view->GetZoomWidget()->show(); - view->GetZoomWidget()->resize(0,0,zoomSize,zoomSize); + view->GetZoomWidget()->resize(0, 0, zoomSize, zoomSize); } - if(run) + if (run) { Fl::run(); } diff --git a/Testing/Code/Visualization/otbImageWidget.cxx b/Testing/Code/Visualization/otbImageWidget.cxx index 03ea41d0ce..26867eed67 100644 --- a/Testing/Code/Visualization/otbImageWidget.cxx +++ b/Testing/Code/Visualization/otbImageWidget.cxx @@ -20,14 +20,14 @@ #include "otbImageFileReader.h" #include <FL/Fl.H> -int otbImageWidget( int argc, char * argv[] ) +int otbImageWidget(int argc, char * argv[]) { const char * infname = argv[1]; const bool useAccel = atoi(argv[2]); // typedefs - typedef otb::ImageWidget<> WidgetType; - typedef WidgetType::InputImageType ImageType; + typedef otb::ImageWidget<> WidgetType; + typedef WidgetType::InputImageType ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; // Reading the input image @@ -42,14 +42,14 @@ int otbImageWidget( int argc, char * argv[] ) widget->SetUseGlAcceleration(useAccel); // Resize it - widget->resize(0,0,region.GetSize()[0],region.GetSize()[1]); + widget->resize(0, 0, region.GetSize()[0], region.GetSize()[1]); // Show it widget->show(); // Refresh display Fl::check(); // Read the OpenGl buffer - widget->ReadBuffer(reader->GetOutput(),region); + widget->ReadBuffer(reader->GetOutput(), region); // Redraw it widget->redraw(); // Refresh display @@ -57,10 +57,10 @@ int otbImageWidget( int argc, char * argv[] ) // Read only a quater of the image ImageType::RegionType::SizeType size = region.GetSize(); - size[0]/=2; + size[0] /= 2; region.SetSize(size); - // Read the OpenGl buffer - widget->ReadBuffer(reader->GetOutput(),region); + // Read the OpenGl buffer + widget->ReadBuffer(reader->GetOutput(), region); // Redraw it widget->redraw(); // Refresh display @@ -68,10 +68,10 @@ int otbImageWidget( int argc, char * argv[] ) // Adding an offset ImageType::RegionType::IndexType index = region.GetIndex(); - index[0]+=size[0]; + index[0] += size[0]; region.SetIndex(index); // Read the OpenGl buffer - widget->ReadBuffer(reader->GetOutput(),region); + widget->ReadBuffer(reader->GetOutput(), region); // Redraw it widget->redraw(); // Refresh display @@ -79,29 +79,29 @@ int otbImageWidget( int argc, char * argv[] ) // Reading full image, but in half window region = reader->GetOutput()->GetLargestPossibleRegion(); - widget->resize(0,0,region.GetSize()[0],region.GetSize()[1]/2); + widget->resize(0, 0, region.GetSize()[0], region.GetSize()[1] / 2); // Read the OpenGl buffer - widget->ReadBuffer(reader->GetOutput(),region); + widget->ReadBuffer(reader->GetOutput(), region); // Redraw it widget->redraw(); // Refresh display Fl::check(); // Reading full image, but in zoomed in widget - widget->resize(0,0,region.GetSize()[0],region.GetSize()[1]); + widget->resize(0, 0, region.GetSize()[0], region.GetSize()[1]); widget->SetIsotropicZoom(2.); // Read the OpenGl buffer - widget->ReadBuffer(reader->GetOutput(),region); + widget->ReadBuffer(reader->GetOutput(), region); // Redraw it widget->redraw(); // Refresh display Fl::check(); // Reading full image, but in zoomed out widget - widget->resize(0,0,region.GetSize()[0],region.GetSize()[1]); + widget->resize(0, 0, region.GetSize()[0], region.GetSize()[1]); widget->SetIsotropicZoom(0.5); // Read the OpenGl buffer - widget->ReadBuffer(reader->GetOutput(),region); + widget->ReadBuffer(reader->GetOutput(), region); // Redraw it widget->redraw(); // Refresh display @@ -111,20 +111,20 @@ int otbImageWidget( int argc, char * argv[] ) // widget->resize(0,0,region.GetSize()[0],region.GetSize()[1]); widget->SetIsotropicZoom(10.0); size = region.GetSize(); - size[0]/=10; - size[1]/=10; + size[0] /= 10; + size[1] /= 10; region.SetSize(size); index = region.GetIndex(); - index[0]+=100; + index[0] += 100; region.SetIndex(index); - widget->ReadBuffer(reader->GetOutput(),region); + widget->ReadBuffer(reader->GetOutput(), region); widget->LinearInterpolationOff(); // Redraw it widget->redraw(); // Refresh display Fl::check(); - // Use nearest neighbor interpolation + // Use nearest neighbor interpolation widget->LinearInterpolationOn(); // Redraw it widget->redraw(); @@ -132,7 +132,7 @@ int otbImageWidget( int argc, char * argv[] ) Fl::check(); // Print out widget status - std::cout<<widget<<std::endl; + std::cout << widget << std::endl; return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbImageWidgetActionHandlerNew.cxx b/Testing/Code/Visualization/otbImageWidgetActionHandlerNew.cxx index 11ff5fd167..15ba31a170 100644 --- a/Testing/Code/Visualization/otbImageWidgetActionHandlerNew.cxx +++ b/Testing/Code/Visualization/otbImageWidgetActionHandlerNew.cxx @@ -17,7 +17,7 @@ =========================================================================*/ #include "otbImageWidgetActionHandler.h" -int otbImageWidgetActionHandlerNew( int argc, char * argv[] ) +int otbImageWidgetActionHandlerNew(int argc, char * argv[]) { typedef otb::ImageWidgetActionHandler HandlerType; HandlerType::Pointer handler = HandlerType::New(); diff --git a/Testing/Code/Visualization/otbImageWidgetController.cxx b/Testing/Code/Visualization/otbImageWidgetController.cxx index 58e09875ef..2c23695d61 100644 --- a/Testing/Code/Visualization/otbImageWidgetController.cxx +++ b/Testing/Code/Visualization/otbImageWidgetController.cxx @@ -18,7 +18,7 @@ #include "otbImageWidgetController.h" #include "otbImageWidgetActionHandler.h" -int otbImageWidgetController( int argc, char * argv[] ) +int otbImageWidgetController(int argc, char * argv[]) { // Typedefs typedef otb::ImageWidgetController ControllerType; @@ -44,13 +44,13 @@ int otbImageWidgetController( int argc, char * argv[] ) controller->RemoveActionHandler(2); // Simulate an event from a widget - controller->HandleWidgetEvent("default",10); + controller->HandleWidgetEvent("default", 10); // Simulate a resize from a widget - controller->HandleWidgetResize("default",0,0); + controller->HandleWidgetResize("default", 0, 0); // Simulate a move from a widget - controller->HandleWidgetMove("default",0,0); + controller->HandleWidgetMove("default", 0, 0); return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbImageWidgetControllerNew.cxx b/Testing/Code/Visualization/otbImageWidgetControllerNew.cxx index 2150634a4e..5a724a4943 100644 --- a/Testing/Code/Visualization/otbImageWidgetControllerNew.cxx +++ b/Testing/Code/Visualization/otbImageWidgetControllerNew.cxx @@ -17,7 +17,7 @@ =========================================================================*/ #include "otbImageWidgetController.h" -int otbImageWidgetControllerNew( int argc, char * argv[] ) +int otbImageWidgetControllerNew(int argc, char * argv[]) { typedef otb::ImageWidgetController ControllerType; ControllerType::Pointer controller = ControllerType::New(); diff --git a/Testing/Code/Visualization/otbImageWidgetNew.cxx b/Testing/Code/Visualization/otbImageWidgetNew.cxx index 5936d86a67..a9d8952857 100644 --- a/Testing/Code/Visualization/otbImageWidgetNew.cxx +++ b/Testing/Code/Visualization/otbImageWidgetNew.cxx @@ -17,13 +17,13 @@ =========================================================================*/ #include "otbImageWidget.h" -int otbImageWidgetNew( int argc, char * argv[] ) +int otbImageWidgetNew(int argc, char * argv[]) { typedef otb::ImageWidget<> WidgetType; WidgetType::Pointer widget = WidgetType::New(); - std::cout<<widget<<std::endl; + std::cout << widget << std::endl; return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbImageWidgetWithVectorDataGlComponent.cxx b/Testing/Code/Visualization/otbImageWidgetWithVectorDataGlComponent.cxx index cee5e6ce6f..a13ec79c16 100644 --- a/Testing/Code/Visualization/otbImageWidgetWithVectorDataGlComponent.cxx +++ b/Testing/Code/Visualization/otbImageWidgetWithVectorDataGlComponent.cxx @@ -24,24 +24,23 @@ #include <FL/Fl.H> -int otbImageWidgetWithVectorDataGlComponent( int argc, char * argv[] ) +int otbImageWidgetWithVectorDataGlComponent(int argc, char * argv[]) { const char * infname = argv[1]; const bool useAccel = atoi(argv[2]); // Widget typedefs - typedef otb::ImageWidget<> WidgetType; - typedef WidgetType::InputImageType ImageType; + typedef otb::ImageWidget<> WidgetType; + typedef WidgetType::InputImageType ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; - // VectorData component typedef - typedef otb::VectorData<double,2> VectorDataType; + typedef otb::VectorData<double, 2> VectorDataType; typedef otb::VectorDataGlComponent<VectorDataType> VectorDataGlComponentType; - typedef VectorDataType::DataNodeType DataNodeType; - typedef DataNodeType::PointType PointType; - typedef DataNodeType::LineType LineType; - typedef DataNodeType::PolygonType PolygonType; + typedef VectorDataType::DataNodeType DataNodeType; + typedef DataNodeType::PointType PointType; + typedef DataNodeType::LineType LineType; + typedef DataNodeType::PolygonType PolygonType; // Reading the input image ReaderType::Pointer reader = ReaderType::New(); @@ -51,11 +50,11 @@ int otbImageWidgetWithVectorDataGlComponent( int argc, char * argv[] ) // Create a VectorData VectorDataType::Pointer data = VectorDataType::New(); - DataNodeType::Pointer document = DataNodeType::New(); - DataNodeType::Pointer folder = DataNodeType::New(); - DataNodeType::Pointer point = DataNodeType::New(); - DataNodeType::Pointer line = DataNodeType::New(); - DataNodeType::Pointer polygon = DataNodeType::New(); + DataNodeType::Pointer document = DataNodeType::New(); + DataNodeType::Pointer folder = DataNodeType::New(); + DataNodeType::Pointer point = DataNodeType::New(); + DataNodeType::Pointer line = DataNodeType::New(); + DataNodeType::Pointer polygon = DataNodeType::New(); document->SetNodeId("DOCUMENT"); folder->SetNodeId("FOLDER"); @@ -63,21 +62,20 @@ int otbImageWidgetWithVectorDataGlComponent( int argc, char * argv[] ) line->SetNodeId("FEATURE_LINE"); polygon->SetNodeId("FEATURE_POLYGON"); - // Create a point on the first quarter of the image PointType p; - p[0] = region.GetIndex()[0]+region.GetSize()[0]/4; - p[1] = region.GetIndex()[1]+region.GetSize()[1]/4; + p[0] = region.GetIndex()[0] + region.GetSize()[0] / 4; + p[1] = region.GetIndex()[1] + region.GetSize()[1] / 4; point->SetPoint(p); // Create a line on the second quarter of the image - LineType::Pointer l = LineType::New(); + LineType::Pointer l = LineType::New(); LineType::ContinuousIndexType cindex; - cindex[0] = region.GetIndex()[0]+region.GetSize()[0]/2; + cindex[0] = region.GetIndex()[0] + region.GetSize()[0] / 2; cindex[1] = region.GetIndex()[1]; l->AddVertex(cindex); - cindex[0] = region.GetIndex()[0]+region.GetSize()[0]; - cindex[1] = region.GetIndex()[1]+region.GetSize()[1]/2; + cindex[0] = region.GetIndex()[0] + region.GetSize()[0]; + cindex[1] = region.GetIndex()[1] + region.GetSize()[1] / 2; l->AddVertex(cindex); line->SetLine(l); @@ -85,43 +83,43 @@ int otbImageWidgetWithVectorDataGlComponent( int argc, char * argv[] ) // Outer ring PolygonType::Pointer outer = PolygonType::New(); - cindex[0] = region.GetIndex()[0]+region.GetSize()[0]/16; - cindex[1] = region.GetIndex()[1]+9*region.GetSize()[1]/16; + cindex[0] = region.GetIndex()[0] + region.GetSize()[0] / 16; + cindex[1] = region.GetIndex()[1] + 9 * region.GetSize()[1] / 16; outer->AddVertex(cindex); - cindex[0] = region.GetIndex()[0]+15*region.GetSize()[0]/16; - cindex[1] = region.GetIndex()[1]+9*region.GetSize()[1]/16; + cindex[0] = region.GetIndex()[0] + 15 * region.GetSize()[0] / 16; + cindex[1] = region.GetIndex()[1] + 9 * region.GetSize()[1] / 16; outer->AddVertex(cindex); - cindex[0] = region.GetIndex()[0]+15*region.GetSize()[0]/16; - cindex[1] = region.GetIndex()[1]+15*region.GetSize()[1]/16; + cindex[0] = region.GetIndex()[0] + 15 * region.GetSize()[0] / 16; + cindex[1] = region.GetIndex()[1] + 15 * region.GetSize()[1] / 16; outer->AddVertex(cindex); - cindex[0] = region.GetIndex()[0]+region.GetSize()[0]/16; - cindex[1] = region.GetIndex()[1]+15*region.GetSize()[1]/16; + cindex[0] = region.GetIndex()[0] + region.GetSize()[0] / 16; + cindex[1] = region.GetIndex()[1] + 15 * region.GetSize()[1] / 16; outer->AddVertex(cindex); polygon->SetPolygonExteriorRing(outer); // Inner ring PolygonType::Pointer inner = PolygonType::New(); - cindex[0] = region.GetIndex()[0]+2*region.GetSize()[0]/16; - cindex[1] = region.GetIndex()[1]+10*region.GetSize()[1]/16; + cindex[0] = region.GetIndex()[0] + 2 * region.GetSize()[0] / 16; + cindex[1] = region.GetIndex()[1] + 10 * region.GetSize()[1] / 16; inner->AddVertex(cindex); - cindex[0] = region.GetIndex()[0]+14*region.GetSize()[0]/16; - cindex[1] = region.GetIndex()[1]+10*region.GetSize()[1]/16; + cindex[0] = region.GetIndex()[0] + 14 * region.GetSize()[0] / 16; + cindex[1] = region.GetIndex()[1] + 10 * region.GetSize()[1] / 16; inner->AddVertex(cindex); - cindex[0] = region.GetIndex()[0]+14*region.GetSize()[0]/16; - cindex[1] = region.GetIndex()[1]+14*region.GetSize()[1]/16; + cindex[0] = region.GetIndex()[0] + 14 * region.GetSize()[0] / 16; + cindex[1] = region.GetIndex()[1] + 14 * region.GetSize()[1] / 16; inner->AddVertex(cindex); - cindex[0] = region.GetIndex()[0]+2*region.GetSize()[0]/16; - cindex[1] = region.GetIndex()[1]+14*region.GetSize()[1]/16; + cindex[0] = region.GetIndex()[0] + 2 * region.GetSize()[0] / 16; + cindex[1] = region.GetIndex()[1] + 14 * region.GetSize()[1] / 16; inner->AddVertex(cindex); polygon->GetPolygonInteriorRings()->PushBack(inner); DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get(); - data->GetDataTree()->Add(document,root); - data->GetDataTree()->Add(folder,document); - data->GetDataTree()->Add(point,folder); - data->GetDataTree()->Add(line,folder); - data->GetDataTree()->Add(polygon,folder); + data->GetDataTree()->Add(document, root); + data->GetDataTree()->Add(folder, document); + data->GetDataTree()->Add(point, folder); + data->GetDataTree()->Add(line, folder); + data->GetDataTree()->Add(polygon, folder); // Create a widget WidgetType::Pointer widget = WidgetType::New(); @@ -129,13 +127,13 @@ int otbImageWidgetWithVectorDataGlComponent( int argc, char * argv[] ) widget->SetUseGlAcceleration(useAccel); // Resize it - widget->resize(0,0,region.GetSize()[0],region.GetSize()[1]); + widget->resize(0, 0, region.GetSize()[0], region.GetSize()[1]); // Show it widget->show(); // Refresh display Fl::check(); // Read the OpenGl buffer - widget->ReadBuffer(reader->GetOutput(),region); + widget->ReadBuffer(reader->GetOutput(), region); // Redraw it widget->redraw(); // Refresh display @@ -149,6 +147,5 @@ int otbImageWidgetWithVectorDataGlComponent( int argc, char * argv[] ) widget->redraw(); Fl::check(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbLayerBasedModelNew.cxx b/Testing/Code/Visualization/otbLayerBasedModelNew.cxx index 2efd745190..d290276d9b 100644 --- a/Testing/Code/Visualization/otbLayerBasedModelNew.cxx +++ b/Testing/Code/Visualization/otbLayerBasedModelNew.cxx @@ -20,12 +20,12 @@ #include "otbImage.h" #include "itkRGBPixel.h" -int otbLayerBasedModelNew( int argc, char * argv[] ) +int otbLayerBasedModelNew(int argc, char * argv[]) { - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType,2> ImageType; - typedef otb::ImageLayerBase<ImageType> LayerType; - typedef otb::LayerBasedModel<LayerType> ModelType; + typedef itk::RGBPixel<unsigned char> RGBPixelType; + typedef otb::Image<RGBPixelType, 2> ImageType; + typedef otb::ImageLayerBase<ImageType> LayerType; + typedef otb::LayerBasedModel<LayerType> ModelType; // Instantiation ModelType::Pointer model = ModelType::New(); diff --git a/Testing/Code/Visualization/otbMultiplyBlendingFunctionNew.cxx b/Testing/Code/Visualization/otbMultiplyBlendingFunctionNew.cxx index 0f79987b00..7866204beb 100644 --- a/Testing/Code/Visualization/otbMultiplyBlendingFunctionNew.cxx +++ b/Testing/Code/Visualization/otbMultiplyBlendingFunctionNew.cxx @@ -18,11 +18,11 @@ #include "otbMultiplyBlendingFunction.h" #include "itkRGBPixel.h" -int otbMultiplyBlendingFunctionNew( int argc, char * argv[] ) +int otbMultiplyBlendingFunctionNew(int argc, char * argv[]) { typedef itk::RGBPixel<unsigned char> RGBPixelType; typedef otb::Function::MultiplyBlendingFunction - <RGBPixelType> BlendingFunctionType; + <RGBPixelType> BlendingFunctionType; BlendingFunctionType::Pointer function = BlendingFunctionType::New(); return EXIT_SUCCESS; diff --git a/Testing/Code/Visualization/otbPackedWidgetManagerNew.cxx b/Testing/Code/Visualization/otbPackedWidgetManagerNew.cxx index 4213d530b7..533a3d44be 100644 --- a/Testing/Code/Visualization/otbPackedWidgetManagerNew.cxx +++ b/Testing/Code/Visualization/otbPackedWidgetManagerNew.cxx @@ -17,10 +17,10 @@ =========================================================================*/ #include "otbPackedWidgetManager.h" -int otbPackedWidgetManagerNew( int argc, char * argv[] ) +int otbPackedWidgetManagerNew(int argc, char * argv[]) { - typedef otb::PackedWidgetManager PackedWidgetManagerType; + typedef otb::PackedWidgetManager PackedWidgetManagerType; PackedWidgetManagerType::Pointer WidgetManager = PackedWidgetManagerType::New(); diff --git a/Testing/Code/Visualization/otbPixelDescriptionModelNew.cxx b/Testing/Code/Visualization/otbPixelDescriptionModelNew.cxx index 3db31ca700..ba9870aa2e 100644 --- a/Testing/Code/Visualization/otbPixelDescriptionModelNew.cxx +++ b/Testing/Code/Visualization/otbPixelDescriptionModelNew.cxx @@ -19,9 +19,9 @@ #include "otbImage.h" #include "otbImageLayer.h" -int otbPixelDescriptionModelNew( int argc, char * argv[] ) +int otbPixelDescriptionModelNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; + typedef otb::Image<double, 2> ImageType; typedef otb::PixelDescriptionModel<ImageType> ModelType; // Instantiation diff --git a/Testing/Code/Visualization/otbPixelDescriptionModelSingleLayer.cxx b/Testing/Code/Visualization/otbPixelDescriptionModelSingleLayer.cxx index c00ef04d30..211732a31f 100644 --- a/Testing/Code/Visualization/otbPixelDescriptionModelSingleLayer.cxx +++ b/Testing/Code/Visualization/otbPixelDescriptionModelSingleLayer.cxx @@ -21,17 +21,17 @@ #include "otbImageLayerGenerator.h" #include "otbImageLayer.h" -int otbPixelDescriptionModelSingleLayer( int argc, char * argv[] ) +int otbPixelDescriptionModelSingleLayer(int argc, char * argv[]) { // params const char * infname = argv[1]; - typedef otb::VectorImage<double,2> ImageType; - typedef otb::Image<itk::RGBAPixel<unsigned char>, 2 > OutputImageType; - typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; - typedef otb::PixelDescriptionModel<OutputImageType> ModelType; + typedef otb::VectorImage<double, 2> ImageType; + typedef otb::Image<itk::RGBAPixel<unsigned char>, 2> OutputImageType; + typedef otb::ImageLayer<ImageType, OutputImageType> LayerType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType; + typedef otb::PixelDescriptionModel<OutputImageType> ModelType; // Instantiation ModelType::Pointer model = ModelType::New(); @@ -39,7 +39,7 @@ int otbPixelDescriptionModelSingleLayer( int argc, char * argv[] ) // Reading input image ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(infname); - + // Generate the layer LayerGeneratorType::Pointer generator = LayerGeneratorType::New(); generator->SetImage(reader->GetOutput()); @@ -49,16 +49,16 @@ int otbPixelDescriptionModelSingleLayer( int argc, char * argv[] ) model->AddLayer(generator->GetLayer()); // Compute extract and scaled extract region - ImageType::RegionType lregion = reader->GetOutput()->GetLargestPossibleRegion(); + ImageType::RegionType lregion = reader->GetOutput()->GetLargestPossibleRegion(); ImageType::RegionType::IndexType index; - index[0] = lregion.GetSize()[0]/4; - index[1] = lregion.GetSize()[1]/4; + index[0] = lregion.GetSize()[0] / 4; + index[1] = lregion.GetSize()[1] / 4; model->UpdatePixelDescription(index); - std::cout<<"Pixel description: "<<std::endl; - std::cout<<model->GetPixelDescription()<<std::endl; + std::cout << "Pixel description: " << std::endl; + std::cout << model->GetPixelDescription() << std::endl; return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbRenderingImageFilterAmplitude.cxx b/Testing/Code/Visualization/otbRenderingImageFilterAmplitude.cxx index 6c169192bc..6bc15c9e40 100644 --- a/Testing/Code/Visualization/otbRenderingImageFilterAmplitude.cxx +++ b/Testing/Code/Visualization/otbRenderingImageFilterAmplitude.cxx @@ -24,60 +24,56 @@ #include "otbStandardRenderingFunction.h" #include "otbAmplitudeFunctor.h" -int otbRenderingImageFilterAmplitude( int argc, char * argv[] ) +int otbRenderingImageFilterAmplitude(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef ImageType::PixelType VectorPixelType; - typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; - typedef otb::RenderingImageFilter<ImageType,RGBImageType> RenderingFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; - typedef otb::Function::AmplitudeFunctor<VectorPixelType> PixelRepresentationFunctionType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef ImageType::PixelType VectorPixelType; + typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; + typedef otb::RenderingImageFilter<ImageType, RGBImageType> RenderingFilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; + typedef otb::Function::AmplitudeFunctor<VectorPixelType> PixelRepresentationFunctionType; typedef otb::Function::StandardRenderingFunction - <VectorPixelType, itk::RGBPixel<unsigned char>, - PixelRepresentationFunctionType> RenderingFunctionType; + <VectorPixelType, itk::RGBPixel<unsigned char>, + PixelRepresentationFunctionType> RenderingFunctionType; typedef RenderingFilterType::RenderingFunctionType::ParametersType ParametersType; // Instantiation - ReaderType::Pointer reader = ReaderType::New(); - RenderingFilterType::Pointer rendering = RenderingFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + RenderingFilterType::Pointer rendering = RenderingFilterType::New(); + WriterType::Pointer writer = WriterType::New(); RenderingFunctionType::Pointer function = RenderingFunctionType::New(); - // reading input image reader->SetFileName(argv[1]); reader->GenerateOutputInformation(); - - // min & max + // min & max // VectorPixelType min(nbComponents); // VectorPixelType max(nbComponents); PixelRepresentationFunctionType::ChannelListType channels; - channels.push_back( atoi(argv[3]) ); - channels.push_back( atoi(argv[4]) ); - unsigned int nbComponents = 1;//To be displayed - ParametersType parameters(2*nbComponents); - for(unsigned int i = 0; i<nbComponents;++i) - { - parameters[i]=atof(argv[5+i]); + channels.push_back(atoi(argv[3])); + channels.push_back(atoi(argv[4])); + unsigned int nbComponents = 1; //To be displayed + ParametersType parameters(2 * nbComponents); + for (unsigned int i = 0; i < nbComponents; ++i) + { + parameters[i] = atof(argv[5 + i]); ++i; - parameters[i]=atof(argv[5+i]); - } + parameters[i] = atof(argv[5 + i]); + } // rendering rendering->SetInput(reader->GetOutput()); rendering->SetRenderingFunction(function); function->SetParameters(parameters); function->GetPixelRepresentationFunction().SetChannelList(channels); - // writing writer->SetFileName(argv[2]); writer->SetInput(rendering->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbRenderingImageFilterNew.cxx b/Testing/Code/Visualization/otbRenderingImageFilterNew.cxx index b9c12c0a78..b61050a939 100644 --- a/Testing/Code/Visualization/otbRenderingImageFilterNew.cxx +++ b/Testing/Code/Visualization/otbRenderingImageFilterNew.cxx @@ -19,15 +19,15 @@ #include "otbImage.h" #include "otbVectorImage.h" -int otbRenderingImageFilterNew( int argc, char * argv[] ) +int otbRenderingImageFilterNew(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType,2> ImageType; - typedef otb::VectorImage<PixelType,2> VectorImageType; - typedef otb::RenderingImageFilter<ImageType> RenderingFilterType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::VectorImage<PixelType, 2> VectorImageType; + typedef otb::RenderingImageFilter<ImageType> RenderingFilterType; typedef otb::RenderingImageFilter<VectorImageType> VectorRenderingFilterType; - RenderingFilterType::Pointer rendering = RenderingFilterType::New(); + RenderingFilterType::Pointer rendering = RenderingFilterType::New(); VectorRenderingFilterType::Pointer vrendering = VectorRenderingFilterType::New(); return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbRenderingImageFilterPhase.cxx b/Testing/Code/Visualization/otbRenderingImageFilterPhase.cxx index 53a22f48bc..dbaa0e05d6 100644 --- a/Testing/Code/Visualization/otbRenderingImageFilterPhase.cxx +++ b/Testing/Code/Visualization/otbRenderingImageFilterPhase.cxx @@ -24,60 +24,56 @@ #include "otbStandardRenderingFunction.h" #include "otbPhaseFunctor.h" -int otbRenderingImageFilterPhase( int argc, char * argv[] ) +int otbRenderingImageFilterPhase(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef ImageType::PixelType VectorPixelType; - typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; - typedef otb::RenderingImageFilter<ImageType,RGBImageType> RenderingFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; - typedef otb::Function::PhaseFunctor<VectorPixelType> PixelRepresentationFunctionType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef ImageType::PixelType VectorPixelType; + typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; + typedef otb::RenderingImageFilter<ImageType, RGBImageType> RenderingFilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; + typedef otb::Function::PhaseFunctor<VectorPixelType> PixelRepresentationFunctionType; typedef otb::Function::StandardRenderingFunction - <VectorPixelType, itk::RGBPixel<unsigned char>, - PixelRepresentationFunctionType > RenderingFunctionType; + <VectorPixelType, itk::RGBPixel<unsigned char>, + PixelRepresentationFunctionType> RenderingFunctionType; typedef RenderingFilterType::RenderingFunctionType::ParametersType ParametersType; // Instantiation - ReaderType::Pointer reader = ReaderType::New(); - RenderingFilterType::Pointer rendering = RenderingFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + RenderingFilterType::Pointer rendering = RenderingFilterType::New(); + WriterType::Pointer writer = WriterType::New(); RenderingFunctionType::Pointer function = RenderingFunctionType::New(); - // reading input image reader->SetFileName(argv[1]); reader->GenerateOutputInformation(); - - // min & max + // min & max // VectorPixelType min(nbComponents); // VectorPixelType max(nbComponents); PixelRepresentationFunctionType::ChannelListType channels; - channels.push_back( atoi(argv[3]) ); - channels.push_back( atoi(argv[4]) ); - unsigned int nbComponents = 1;//To be displayed - ParametersType parameters(2*nbComponents); - for(unsigned int i = 0; i<nbComponents;++i) - { - parameters[i]=atof(argv[5+i]); + channels.push_back(atoi(argv[3])); + channels.push_back(atoi(argv[4])); + unsigned int nbComponents = 1; //To be displayed + ParametersType parameters(2 * nbComponents); + for (unsigned int i = 0; i < nbComponents; ++i) + { + parameters[i] = atof(argv[5 + i]); ++i; - parameters[i]=atof(argv[5+i]); - } + parameters[i] = atof(argv[5 + i]); + } // rendering rendering->SetInput(reader->GetOutput()); rendering->SetRenderingFunction(function); function->SetParameters(parameters); function->GetPixelRepresentationFunction().SetChannelList(channels); - // writing writer->SetFileName(argv[2]); writer->SetInput(rendering->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbRenderingImageFilterScalar.cxx b/Testing/Code/Visualization/otbRenderingImageFilterScalar.cxx index 48e6adf450..90f0b55321 100644 --- a/Testing/Code/Visualization/otbRenderingImageFilterScalar.cxx +++ b/Testing/Code/Visualization/otbRenderingImageFilterScalar.cxx @@ -21,14 +21,14 @@ #include "otbStreamingImageFileWriter.h" #include "itkRGBPixel.h" -int otbRenderingImageFilterScalar( int argc, char * argv[] ) +int otbRenderingImageFilterScalar(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::Image<PixelType,2> ImageType; - typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; - typedef otb::RenderingImageFilter<ImageType,RGBImageType> RenderingFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; + typedef otb::RenderingImageFilter<ImageType, RGBImageType> RenderingFilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; typedef RenderingFilterType::RenderingFunctionType::ParametersType ParametersType; // Instantiation @@ -40,8 +40,8 @@ int otbRenderingImageFilterScalar( int argc, char * argv[] ) // PixelType min = atof(argv[3]); // PixelType max = atof(argv[4]); ParametersType parameters(2); - parameters[0] = atof(argv[3]);//min - parameters[1] = atof(argv[4]);//max + parameters[0] = atof(argv[3]); //min + parameters[1] = atof(argv[4]); //max // reading input image reader->SetFileName(argv[1]); @@ -55,6 +55,5 @@ int otbRenderingImageFilterScalar( int argc, char * argv[] ) writer->SetInput(rendering->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbRenderingImageFilterVector.cxx b/Testing/Code/Visualization/otbRenderingImageFilterVector.cxx index 01017da2b6..aa150601bc 100644 --- a/Testing/Code/Visualization/otbRenderingImageFilterVector.cxx +++ b/Testing/Code/Visualization/otbRenderingImageFilterVector.cxx @@ -23,45 +23,44 @@ #include "itkRGBPixel.h" #include "otbStandardRenderingFunction.h" -int otbRenderingImageFilterVector( int argc, char * argv[] ) +int otbRenderingImageFilterVector(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef ImageType::PixelType VectorPixelType; - typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; - typedef otb::RenderingImageFilter<ImageType,RGBImageType> RenderingFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; - typedef otb::Function::StandardRenderingFunction<VectorPixelType,itk::RGBPixel<unsigned char> > RenderingFunctionType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef ImageType::PixelType VectorPixelType; + typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; + typedef otb::RenderingImageFilter<ImageType, RGBImageType> RenderingFilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; + typedef otb::Function::StandardRenderingFunction<VectorPixelType, + itk::RGBPixel<unsigned char> > RenderingFunctionType; typedef RenderingFilterType::RenderingFunctionType::ParametersType ParametersType; // Instantiation - ReaderType::Pointer reader = ReaderType::New(); - RenderingFilterType::Pointer rendering = RenderingFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + RenderingFilterType::Pointer rendering = RenderingFilterType::New(); + WriterType::Pointer writer = WriterType::New(); RenderingFunctionType::Pointer function = RenderingFunctionType::New(); - // reading input image reader->SetFileName(argv[1]); reader->GenerateOutputInformation(); - - // min & max + // min & max // VectorPixelType min(nbComponents); // VectorPixelType max(nbComponents); - unsigned int channelRed = atoi(argv[3]); - unsigned int channelGreen = atoi(argv[4]); - unsigned int channelBlue = atoi(argv[5]); - unsigned int nbComponents = 3;//To be displayed - ParametersType parameters(2*nbComponents); - for(unsigned int i = 0; i<parameters.Size();++i) - { - parameters[i]=atof(argv[6+i]); + unsigned int channelRed = atoi(argv[3]); + unsigned int channelGreen = atoi(argv[4]); + unsigned int channelBlue = atoi(argv[5]); + unsigned int nbComponents = 3; //To be displayed + ParametersType parameters(2 * nbComponents); + for (unsigned int i = 0; i < parameters.Size(); ++i) + { + parameters[i] = atof(argv[6 + i]); ++i; - parameters[i]=atof(argv[6+i]); - } + parameters[i] = atof(argv[6 + i]); + } // rendering rendering->SetInput(reader->GetOutput()); @@ -78,6 +77,5 @@ int otbRenderingImageFilterVector( int argc, char * argv[] ) writer->SetInput(rendering->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbRenderingImageFilterVectorWithExpNegativeTransfer.cxx b/Testing/Code/Visualization/otbRenderingImageFilterVectorWithExpNegativeTransfer.cxx index 2c074ee7f6..ba799a0325 100644 --- a/Testing/Code/Visualization/otbRenderingImageFilterVectorWithExpNegativeTransfer.cxx +++ b/Testing/Code/Visualization/otbRenderingImageFilterVectorWithExpNegativeTransfer.cxx @@ -25,48 +25,47 @@ #include "otbChannelSelectorFunctor.h" #include "itkExpNegativeImageFilter.h" -int otbRenderingImageFilterVectorWithExpNegativeTransfer( int argc, char * argv[] ) +int otbRenderingImageFilterVectorWithExpNegativeTransfer(int argc, char * argv[]) { - typedef double PixelType; - typedef otb::VectorImage<PixelType,2> ImageType; - typedef ImageType::PixelType VectorPixelType; - typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; - typedef otb::RenderingImageFilter<ImageType,RGBImageType> RenderingFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; - typedef otb::Function::ChannelSelectorFunctor<VectorPixelType> PixelRepresentationFunctionType; - typedef itk::Function::ExpNegative<PixelType,PixelType> ExpNegativeFunctionType; + typedef double PixelType; + typedef otb::VectorImage<PixelType, 2> ImageType; + typedef ImageType::PixelType VectorPixelType; + typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; + typedef otb::RenderingImageFilter<ImageType, RGBImageType> RenderingFilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<RGBImageType> WriterType; + typedef otb::Function::ChannelSelectorFunctor<VectorPixelType> PixelRepresentationFunctionType; + typedef itk::Function::ExpNegative<PixelType, PixelType> ExpNegativeFunctionType; typedef otb::Function::StandardRenderingFunction< VectorPixelType, itk::RGBPixel<unsigned char>, PixelRepresentationFunctionType, - ExpNegativeFunctionType > RenderingFunctionType; - typedef RenderingFunctionType::ParametersType ParametersType; + ExpNegativeFunctionType> RenderingFunctionType; + typedef RenderingFunctionType::ParametersType ParametersType; // Instantiation - ReaderType::Pointer reader = ReaderType::New(); - RenderingFilterType::Pointer rendering = RenderingFilterType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + RenderingFilterType::Pointer rendering = RenderingFilterType::New(); + WriterType::Pointer writer = WriterType::New(); RenderingFunctionType::Pointer function = RenderingFunctionType::New(); - // reading input image reader->SetFileName(argv[1]); reader->GenerateOutputInformation(); - unsigned int nbComponents = 3;//To be displayed + unsigned int nbComponents = 3; //To be displayed - // min & max - ParametersType parameters(2*nbComponents); + // min & max + ParametersType parameters(2 * nbComponents); unsigned int channelRed = atoi(argv[3]); unsigned int channelGreen = atoi(argv[4]); unsigned int channelBlue = atoi(argv[5]); - for(unsigned int i = 0; i<parameters.Size();++i) - { - parameters[i]=atof(argv[7+i]); + for (unsigned int i = 0; i < parameters.Size(); ++i) + { + parameters[i] = atof(argv[7 + i]); ++i; - parameters[i]=atof(argv[7+i]); - } + parameters[i] = atof(argv[7 + i]); + } // rendering rendering->SetInput(reader->GetOutput()); @@ -82,6 +81,5 @@ int otbRenderingImageFilterVectorWithExpNegativeTransfer( int argc, char * argv[ writer->SetInput(rendering->GetOutput()); writer->Update(); - return EXIT_SUCCESS; } diff --git a/Testing/Code/Visualization/otbSplittedWidgetManagerNew.cxx b/Testing/Code/Visualization/otbSplittedWidgetManagerNew.cxx index 918d3ba393..b5ef6267ac 100644 --- a/Testing/Code/Visualization/otbSplittedWidgetManagerNew.cxx +++ b/Testing/Code/Visualization/otbSplittedWidgetManagerNew.cxx @@ -17,10 +17,10 @@ =========================================================================*/ #include "otbSplittedWidgetManager.h" -int otbSplittedWidgetManagerNew( int argc, char * argv[] ) +int otbSplittedWidgetManagerNew(int argc, char * argv[]) { - typedef otb::SplittedWidgetManager SplittedWidgetManagerType; + typedef otb::SplittedWidgetManager SplittedWidgetManagerType; SplittedWidgetManagerType::Pointer widgetManager = SplittedWidgetManagerType::New(); diff --git a/Testing/Code/Visualization/otbStandardImageViewer.cxx b/Testing/Code/Visualization/otbStandardImageViewer.cxx index 58c062d694..30231d1943 100644 --- a/Testing/Code/Visualization/otbStandardImageViewer.cxx +++ b/Testing/Code/Visualization/otbStandardImageViewer.cxx @@ -22,47 +22,47 @@ #include "otbVectorDataFileReader.h" #include "itkTimeProbe.h" -int otbStandardImageViewer( int argc, char * argv[] ) +int otbStandardImageViewer(int argc, char * argv[]) { bool run = atoi(argv[2]); - typedef otb::VectorImage<double,2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StandardImageViewer<ImageType> ViewerType; - typedef otb::VectorData<double> VectorDataType; + typedef otb::VectorImage<double, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StandardImageViewer<ImageType> ViewerType; + typedef otb::VectorData<double> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer vreader = VectorDataFileReaderType::New(); - ReaderType::Pointer reader = ReaderType::New(); - ViewerType::Pointer viewer = ViewerType::New(); + ReaderType::Pointer reader = ReaderType::New(); + ViewerType::Pointer viewer = ViewerType::New(); VectorDataFileReaderType::Pointer vdreader = VectorDataFileReaderType::New(); reader->SetFileName(argv[1]); viewer->SetImage(reader->GetOutput()); - if(argc>3) + if (argc > 3) { - std::cout<<"Adding a vector layer from file "<<argv[3]<<std::endl; + std::cout << "Adding a vector layer from file " << argv[3] << std::endl; itk::TimeProbe chrono; chrono.Start(); vdreader->SetFileName(argv[3]); vdreader->Update(); chrono.Stop(); - std::cout<<"VectorData loaded in "<<chrono.GetMeanTime()<<" s."<<std::endl; + std::cout << "VectorData loaded in " << chrono.GetMeanTime() << " s." << std::endl; viewer->SetVectorData(vdreader->GetOutput()); } - if(argc>4) + if (argc > 4) { - std::cout<<"Reprojecting using DEM "<<argv[4]<<std::endl; + std::cout << "Reprojecting using DEM " << argv[4] << std::endl; viewer->SetDEMDirectory(argv[4]); } viewer->SetLabel("Testing standard viewer"); viewer->Update(); - - if(run) + + if (run) { Fl::run(); } diff --git a/Testing/Code/Visualization/otbStandardImageViewerNew.cxx b/Testing/Code/Visualization/otbStandardImageViewerNew.cxx index d631cb5d26..f97ccd7189 100644 --- a/Testing/Code/Visualization/otbStandardImageViewerNew.cxx +++ b/Testing/Code/Visualization/otbStandardImageViewerNew.cxx @@ -18,9 +18,9 @@ #include "otbStandardImageViewer.h" #include "otbImage.h" -int otbStandardImageViewerNew( int argc, char * argv[] ) +int otbStandardImageViewerNew(int argc, char * argv[]) { - typedef otb::Image<double,2> ImageType; + typedef otb::Image<double, 2> ImageType; typedef otb::StandardImageViewer<ImageType> ViewerType; ViewerType::Pointer layer = ViewerType::New(); diff --git a/Testing/Code/Visualization/otbStandardImageViewerRGBNew.cxx b/Testing/Code/Visualization/otbStandardImageViewerRGBNew.cxx index 1cacb3ec57..c51effdc85 100644 --- a/Testing/Code/Visualization/otbStandardImageViewerRGBNew.cxx +++ b/Testing/Code/Visualization/otbStandardImageViewerRGBNew.cxx @@ -25,7 +25,7 @@ int otbStandardImageViewerRGBNew(int argc, char * argv[]) { typedef otb::Image<itk::RGBPixel<unsigned char>, 2> ImageType; - typedef otb::StandardImageViewer<ImageType> ViewerType; + typedef otb::StandardImageViewer<ImageType> ViewerType; ViewerType::Pointer viewer = ViewerType::New(); viewer->Update(); diff --git a/Testing/Code/Visualization/otbStandardRenderingFunctionNew.cxx b/Testing/Code/Visualization/otbStandardRenderingFunctionNew.cxx index 0933496d43..74f5ede90f 100644 --- a/Testing/Code/Visualization/otbStandardRenderingFunctionNew.cxx +++ b/Testing/Code/Visualization/otbStandardRenderingFunctionNew.cxx @@ -18,12 +18,12 @@ #include "otbStandardRenderingFunction.h" #include "itkRGBPixel.h" -int otbStandardRenderingFunctionNew( int argc, char * argv[] ) +int otbStandardRenderingFunctionNew(int argc, char * argv[]) { typedef double PixelType; typedef itk::RGBPixel<unsigned char> RGBPixelType; typedef otb::Function::StandardRenderingFunction - <PixelType,RGBPixelType> StandardRenderingFunctionType; + <PixelType, RGBPixelType> StandardRenderingFunctionType; StandardRenderingFunctionType::Pointer function = StandardRenderingFunctionType::New(); return EXIT_SUCCESS; diff --git a/Testing/Code/Visualization/otbUniformAlphaBlendingFunctionNew.cxx b/Testing/Code/Visualization/otbUniformAlphaBlendingFunctionNew.cxx index 8208536154..90655d1d6d 100644 --- a/Testing/Code/Visualization/otbUniformAlphaBlendingFunctionNew.cxx +++ b/Testing/Code/Visualization/otbUniformAlphaBlendingFunctionNew.cxx @@ -18,11 +18,11 @@ #include "otbUniformAlphaBlendingFunction.h" #include "itkRGBPixel.h" -int otbUniformAlphaBlendingFunctionNew( int argc, char * argv[] ) +int otbUniformAlphaBlendingFunctionNew(int argc, char * argv[]) { typedef itk::RGBPixel<unsigned char> RGBPixelType; typedef otb::Function::UniformAlphaBlendingFunction - <RGBPixelType> BlendingFunctionType; + <RGBPixelType> BlendingFunctionType; BlendingFunctionType::Pointer function = BlendingFunctionType::New(); return EXIT_SUCCESS; diff --git a/Testing/Code/Visualization/otbVectorDataGlComponentNew.cxx b/Testing/Code/Visualization/otbVectorDataGlComponentNew.cxx index 1a29ad6852..4db89a7a6e 100644 --- a/Testing/Code/Visualization/otbVectorDataGlComponentNew.cxx +++ b/Testing/Code/Visualization/otbVectorDataGlComponentNew.cxx @@ -20,7 +20,7 @@ int otbVectorDataGlComponentNew(int argc, char * argv[]) { - typedef otb::VectorData<double,2> VectorDataType; + typedef otb::VectorData<double, 2> VectorDataType; typedef otb::VectorDataGlComponent<VectorDataType> VectorDataGlComponentType; // Instantiation diff --git a/Testing/Code/Visualization/otbVectorDataModelNew.cxx b/Testing/Code/Visualization/otbVectorDataModelNew.cxx index 3ddbe26acd..a9ee3c09e5 100644 --- a/Testing/Code/Visualization/otbVectorDataModelNew.cxx +++ b/Testing/Code/Visualization/otbVectorDataModelNew.cxx @@ -17,7 +17,7 @@ =========================================================================*/ #include "otbVectorDataModel.h" -int otbVectorDataModelNew( int argc, char * argv[] ) +int otbVectorDataModelNew(int argc, char * argv[]) { typedef otb::VectorDataModel ModelType; diff --git a/Testing/Code/Visualization/otbVerticalAsymptoteCurveNew.cxx b/Testing/Code/Visualization/otbVerticalAsymptoteCurveNew.cxx index 61ca16e53b..4423b6620f 100644 --- a/Testing/Code/Visualization/otbVerticalAsymptoteCurveNew.cxx +++ b/Testing/Code/Visualization/otbVerticalAsymptoteCurveNew.cxx @@ -17,10 +17,10 @@ =========================================================================*/ #include "otbVerticalAsymptoteCurve.h" -int otbVerticalAsymptoteCurveNew( int argc, char * argv[] ) +int otbVerticalAsymptoteCurveNew(int argc, char * argv[]) { - typedef otb::VerticalAsymptoteCurve VerticalAsymptoteCurveType; + typedef otb::VerticalAsymptoteCurve VerticalAsymptoteCurveType; VerticalAsymptoteCurveType::Pointer vaCurve = VerticalAsymptoteCurveType::New(); diff --git a/Testing/Code/Visualization/otbVisualizationTests1.cxx b/Testing/Code/Visualization/otbVisualizationTests1.cxx index a6a009b8a7..1f323dbc7e 100644 --- a/Testing/Code/Visualization/otbVisualizationTests1.cxx +++ b/Testing/Code/Visualization/otbVisualizationTests1.cxx @@ -71,4 +71,3 @@ void RegisterTests() REGISTER_TEST(otbVerticalAsymptoteCurveNew); REGISTER_TEST(otbVectorDataModelNew); } - diff --git a/Testing/Fa/0000041-mean_shift.cxx b/Testing/Fa/0000041-mean_shift.cxx index a85bfae3a7..33310f5551 100644 --- a/Testing/Fa/0000041-mean_shift.cxx +++ b/Testing/Fa/0000041-mean_shift.cxx @@ -7,64 +7,62 @@ //Code adapted from submission from Christophe Simler // http://bugs.orfeo-toolbox.org/view.php?id=41 -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { if (argc < 9) - { - std::cout << "Usage : inputImage rangeRadius spatialRadius minRegionSize outfilenamefiltered outfilenamesegmented outfilenamelabeled outfilenameboundary" << std::endl; + { + std::cout << + "Usage : inputImage rangeRadius spatialRadius minRegionSize outfilenamefiltered outfilenamesegmented outfilenamelabeled outfilenameboundary" + << std::endl; return EXIT_FAILURE; - } + } char * filename = argv[1]; - int rangeRadius = atoi(argv[2]); - int spatialRadius = atoi(argv[3]); - int minRegionSize = atoi(argv[4]); + int rangeRadius = atoi(argv[2]); + int spatialRadius = atoi(argv[3]); + int minRegionSize = atoi(argv[4]); char * outfilenamefiltered = argv[5]; char * outfilenamesegmented = argv[6]; char * outfilenamelabeled = argv[7]; char * outfilenameboundary = argv[8]; - - typedef otb::VectorImage< unsigned char, 2 > ImageType; // image d'entrée, image filtrée et image segmenté - typedef otb::Image< int, 2 > TLabeledOutput; // image labelisée,image des contours (de l'image labellisée) - + typedef otb::VectorImage<unsigned char, 2> ImageType; // image d'entrée, image filtrée et image segmenté + typedef otb::Image<int, 2> TLabeledOutput; // image labelisée,image des contours (de l'image labellisée) // lecture de l'image d'entree a partir d'un fichier - typedef otb::ImageFileReader< ImageType > ReaderType; + typedef otb::ImageFileReader<ImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(filename); // traitement avec le filtre - typedef otb::MeanShiftVectorImageFilter< ImageType, ImageType, TLabeledOutput > FilterType; + typedef otb::MeanShiftVectorImageFilter<ImageType, ImageType, TLabeledOutput> FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetRangeRadius(rangeRadius); filter->SetSpatialRadius(spatialRadius); filter->SetMinimumRegionSize(minRegionSize); - // sauvegarde de l'image filtrée, - typedef otb::StreamingImageFileWriter<ImageType> WriterType1; - WriterType1::Pointer writer1=WriterType1::New(); + typedef otb::StreamingImageFileWriter<ImageType> WriterType1; + WriterType1::Pointer writer1 = WriterType1::New(); writer1->SetFileName(outfilenamefiltered); // sauvegarde de l'image segmenté, - typedef otb::StreamingImageFileWriter<ImageType> WriterType2; - WriterType2::Pointer writer2=WriterType2::New(); + typedef otb::StreamingImageFileWriter<ImageType> WriterType2; + WriterType2::Pointer writer2 = WriterType2::New(); writer2->SetFileName(outfilenamesegmented); // sauvegarde de l'image labelisée - typedef otb::StreamingImageFileWriter<TLabeledOutput> WriterType3; - WriterType3::Pointer writer3=WriterType3::New(); + typedef otb::StreamingImageFileWriter<TLabeledOutput> WriterType3; + WriterType3::Pointer writer3 = WriterType3::New(); writer3->SetFileName(outfilenamelabeled); // sauvegarde de l'image de contours - typedef otb::StreamingImageFileWriter<TLabeledOutput> WriterType4; - WriterType4::Pointer writer4=WriterType4::New(); + typedef otb::StreamingImageFileWriter<TLabeledOutput> WriterType4; + WriterType4::Pointer writer4 = WriterType4::New(); writer4->SetFileName(outfilenameboundary); - // construction du pipeline filter->SetInput(reader->GetOutput()); @@ -80,5 +78,3 @@ int main( int argc, char *argv[] ) return 0; } - - diff --git a/Testing/Fa/0000132-jpg.cxx b/Testing/Fa/0000132-jpg.cxx index e42e62c890..6e46e54ed5 100644 --- a/Testing/Fa/0000132-jpg.cxx +++ b/Testing/Fa/0000132-jpg.cxx @@ -22,7 +22,7 @@ //Code adapted from submission from Jordi INGLADA // http://bugs.orfeo-toolbox.org/view.php?id=132 -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { if (argc < 1) { @@ -31,11 +31,11 @@ int main( int argc, char *argv[] ) } char * filename = argv[1]; - - typedef double PixelType; - typedef otb::VectorImage< PixelType > ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - + + typedef double PixelType; + typedef otb::VectorImage<PixelType> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + // check for input images ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(filename); diff --git a/Testing/Fa/00134-feature_extraction.cxx b/Testing/Fa/00134-feature_extraction.cxx index 3c6f99cc8a..5ab59d8661 100644 --- a/Testing/Fa/00134-feature_extraction.cxx +++ b/Testing/Fa/00134-feature_extraction.cxx @@ -10,8 +10,8 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -30,28 +30,27 @@ #include "otbMultiChannelRAndNIRIndexImageFilter.h" #include "otbVegetationIndicesFunctor.h" - int main(int argc, char* argv[]) { - const char * inputName = argv[1]; - const char * outputName = argv[2]; + const char * inputName = argv[1]; + const char * outputName = argv[2]; const unsigned int radius = atoi(argv[3]); - - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::VectorImage<PixelType, 2> VectorImageType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; - - typedef otb::ImageList< ImageType > ImageListType; - typedef otb::ImageListToVectorImageFilter<ImageListType, VectorImageType> ListToImageFilterType; - typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType> ExtractorFilterType; - typedef itk::MeanImageFilter<ImageType, ImageType> MeanFilterType; - typedef otb::Functor::NDVI< PixelType, PixelType, PixelType > NDVIFunctorType; - typedef otb::MultiChannelRAndNIRIndexImageFilter<VectorImageType,ImageType,NDVIFunctorType> NDVIFilterType; + + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::VectorImage<PixelType, 2> VectorImageType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::ImageFileWriter<VectorImageType> WriterType; + + typedef otb::ImageList<ImageType> ImageListType; + typedef otb::ImageListToVectorImageFilter<ImageListType, VectorImageType> ListToImageFilterType; + typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType> ExtractorFilterType; + typedef itk::MeanImageFilter<ImageType, ImageType> MeanFilterType; + typedef otb::Functor::NDVI<PixelType, PixelType, PixelType> NDVIFunctorType; + typedef otb::MultiChannelRAndNIRIndexImageFilter<VectorImageType, ImageType, NDVIFunctorType> NDVIFilterType; ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); ImageListType::Pointer imListOut = ImageListType::New(); ExtractorFilterType::Pointer extract = ExtractorFilterType::New(); MeanFilterType::Pointer meanner = MeanFilterType::New(); @@ -61,35 +60,33 @@ int main(int argc, char* argv[]) reader->SetFileName(inputName); reader->GenerateOutputInformation(); - extract->SetInput( reader->GetOutput() ); + extract->SetInput(reader->GetOutput()); extract->SetChannel(1); extract->UpdateOutputInformation(); ImageType::SizeType rad; rad[0] = radius; rad[1] = radius; - meanner->SetInput( extract->GetOutput() ); - meanner->SetRadius( rad ); - - ndvi->SetInput( reader->GetOutput() ); + meanner->SetInput(extract->GetOutput()); + meanner->SetRadius(rad); - imListOut->PushBack( meanner->GetOutput() ); - imListOut->PushBack( ndvi->GetOutput() ); + ndvi->SetInput(reader->GetOutput()); + + imListOut->PushBack(meanner->GetOutput()); + imListOut->PushBack(ndvi->GetOutput()); - caster->SetInput(imListOut); - writer->SetInput(caster->GetOutput() ); + writer->SetInput(caster->GetOutput()); writer->SetFileName(outputName); writer->Update(); - /*** With 2 writers : OK */ /* typedef otb::ImageFileWriter<ImageType> WriterMonoType; - WriterMonoType::Pointer w1 = WriterMonoType::New(); - WriterMonoType::Pointer w2 = WriterMonoType::New(); + WriterMonoType::Pointer w1 = WriterMonoType::New(); + WriterMonoType::Pointer w2 = WriterMonoType::New(); w1->SetInput( imListOut->GetNthElement(0) ); - w2->SetInput( imListOut->GetNthElement(1) ); + w2->SetInput( imListOut->GetNthElement(1) ); w1->SetFileName("meaner.tif"); w2->SetFileName("ndvi.tif"); w1->Update(); diff --git a/Testing/Fa/AlignementsQB.cxx b/Testing/Fa/AlignementsQB.cxx index 7592d70f86..93d96e0c9c 100644 --- a/Testing/Fa/AlignementsQB.cxx +++ b/Testing/Fa/AlignementsQB.cxx @@ -27,12 +27,11 @@ #include "otbDrawPathFilter.h" //#include "otbColorImageViewer.h" - #include <stdio.h> -int main( int argc, char ** argv ) +int main(int argc, char ** argv) { - if(argc!=3) + if (argc != 3) { std::cout << "Usage : " << argv[0] << " inputImage outputImage" << std::endl; @@ -43,64 +42,60 @@ int main( int argc, char ** argv ) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image<InputPixelType, Dimension> InputImageType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader<InputImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName(inputFilename); + writer->SetFileName(outputFilename); reader->Update(); std::cout << "Lecture terminee" << std::endl; - typedef otb::ExtractROI<InputPixelType,InputPixelType> ROIFilterType; + typedef otb::ExtractROI<InputPixelType, InputPixelType> ROIFilterType; ROIFilterType::Pointer roiFilter = ROIFilterType::New(); - roiFilter->SetInput( reader->GetOutput() ); - roiFilter->SetStartX( 10 ); - roiFilter->SetStartY( 0 ); - roiFilter->SetSizeX( 256 ); - roiFilter->SetSizeY( 256 ); - + roiFilter->SetInput(reader->GetOutput()); + roiFilter->SetStartX(10); + roiFilter->SetStartY(0); + roiFilter->SetSizeX(256); + roiFilter->SetSizeY(256); roiFilter->Update(); std::cout << "Extraction ROI" << std::endl; - typedef itk::PolyLineParametricPath< Dimension > PathType; - typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> ListAlignFilterType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> ListAlignFilterType; ListAlignFilterType::Pointer alignFilter = ListAlignFilterType::New(); - alignFilter->SetInput( roiFilter->GetOutput() ); + alignFilter->SetInput(roiFilter->GetOutput()); alignFilter->Update(); std::cout << "Alignements termines" << std::endl; - typedef ROIFilterType::OutputImageType BackgroundImageType; - typedef otb::DrawPathFilter< BackgroundImageType, PathType, OutputImageType > DrawPathFilterType; + typedef otb::DrawPathFilter<BackgroundImageType, PathType, OutputImageType> DrawPathFilterType; DrawPathFilterType::Pointer drawPathFilter = DrawPathFilterType::New(); typedef ListAlignFilterType::OutputPathListType ListType; - ListType* listePaths = alignFilter->GetOutput(); ListType::Iterator listIt = listePaths->Begin(); @@ -111,10 +106,10 @@ int main( int argc, char ** argv ) unsigned int color = 0; - while( listIt != listePaths->End()) + while (listIt != listePaths->End()) { - drawPathFilter->SetImageInput( backgroundImage ); + drawPathFilter->SetImageInput(backgroundImage); drawPathFilter->SetInputPath(listIt.Get()); //drawPathFilter->SetPathValue( color ); @@ -125,15 +120,12 @@ int main( int argc, char ** argv ) ++listIt; ++color; - } - - writer->SetInput( drawPathFilter->GetOutput() ); + writer->SetInput(drawPathFilter->GetOutput()); writer->Update(); - /* typedef otb::ColorImageViewer<unsigned char,double> ViewerType; ViewerType viewer; @@ -144,8 +136,5 @@ int main( int argc, char ** argv ) Fl::run(); */ - return EXIT_SUCCESS; } - - diff --git a/Testing/Fa/MapActivation.cxx b/Testing/Fa/MapActivation.cxx index 82d772ee88..0351519fe8 100644 --- a/Testing/Fa/MapActivation.cxx +++ b/Testing/Fa/MapActivation.cxx @@ -43,18 +43,18 @@ #include "itkVariableLengthVector.h" #include "itkMembershipSample.h" - -int main(int argc, char* argv[] ) +int main(int argc, char* argv[]) { if (argc < 12) { - std::cout << "Usage : " << argv[0] << " inputTabImage size radius NumberOfIterations BetaInit BetaEnd MaxWeight MinWeight som actMap som" << std::endl; + std::cout << "Usage : " << argv[0] << + " inputTabImage size radius NumberOfIterations BetaInit BetaEnd MaxWeight MinWeight som actMap som" << std::endl; - return EXIT_FAILURE; + return EXIT_FAILURE; } - typedef otb::Image<double, 2 > ListImageType; + typedef otb::Image<double, 2> ListImageType; typedef otb::ImageFileReader<ListImageType> TabReaderType; TabReaderType::Pointer Tabreader = TabReaderType::New(); @@ -62,46 +62,45 @@ int main(int argc, char* argv[] ) Tabreader->Update(); ListImageType::Pointer tabreadImage = Tabreader->GetOutput(); - typedef itk::ImageRegionIterator< ListImageType > IteratorType; - IteratorType It1( tabreadImage, tabreadImage->GetLargestPossibleRegion() ); - const int nblines= 591; //const int)(tabreadImage->GetLargestPossibleRegion().GetSize()[1]); + typedef itk::ImageRegionIterator<ListImageType> IteratorType; + IteratorType It1(tabreadImage, tabreadImage->GetLargestPossibleRegion()); + const int nblines = 591; //const int)(tabreadImage->GetLargestPossibleRegion().GetSize()[1]); - const int nbcolonnes= 9; //(const int)tabreadImage->GetLargestPossibleRegion().GetSize()[0]; + const int nbcolonnes = 9; //(const int)tabreadImage->GetLargestPossibleRegion().GetSize()[0]; double vectTab[nblines][nbcolonnes]; - std::cout<<"lignes = "<<nblines<<" colonnes = "<<nbcolonnes<<std::endl; - for ( It1.GoToBegin(); !It1.IsAtEnd();++It1) + std::cout << "lignes = " << nblines << " colonnes = " << nbcolonnes << std::endl; + for (It1.GoToBegin(); !It1.IsAtEnd(); ++It1) { - vectTab[It1.GetIndex()[1]][It1.GetIndex()[0]]=It1.Get(); + vectTab[It1.GetIndex()[1]][It1.GetIndex()[0]] = It1.Get(); } - typedef itk::VariableLengthVector< double > MeasurementVectorType; - typedef itk::Statistics::ListSample< MeasurementVectorType > SampleType; + typedef itk::VariableLengthVector<double> MeasurementVectorType; + typedef itk::Statistics::ListSample<MeasurementVectorType> SampleType; SampleType::Pointer liste = SampleType::New(); - for(int j=0;j<nblines;j++) + for (int j = 0; j < nblines; j++) { - MeasurementVectorType tab; - tab.SetSize(nbcolonnes); - for(int i=0;i<nbcolonnes;i++) - { - tab[i] = vectTab[j][i]; - } - liste->PushBack(tab); + MeasurementVectorType tab; + tab.SetSize(nbcolonnes); + for (int i = 0; i < nbcolonnes; i++) + { + tab[i] = vectTab[j][i]; + } + liste->PushBack(tab); } // std::cout<<"liste: "<<liste->GetMeasurementVectorSize()<< " " << liste->GetMeasurementVector(1) // <<" " <<liste->GetMeasurementVector(2)<< " " <<liste->GetMeasurementVector(3)<<std::endl; - typedef itk::Statistics::EuclideanDistance<MeasurementVectorType> DistanceType; - typedef otb::SOMMap<MeasurementVectorType,DistanceType,2> MapType; + typedef otb::SOMMap<MeasurementVectorType, DistanceType, 2> MapType; - typedef otb::SOM<SampleType,MapType> SOMType; + typedef otb::SOM<SampleType, MapType> SOMType; SOMType::Pointer som = SOMType::New(); som->SetListSample(liste); SOMType::SizeType som_size; - som_size[0]=atoi(argv[2]); - som_size[1]=atoi(argv[2]); + som_size[0] = atoi(argv[2]); + som_size[1] = atoi(argv[2]); som->SetMapSize(som_size); SOMType::SizeType radius; radius[0] = atoi(argv[3]); @@ -115,34 +114,33 @@ int main(int argc, char* argv[] ) som->SetMinWeight(atoi(argv[8])); som->Update(); - typedef otb::ImageFileWriter<MapType> SomWriterType; SomWriterType::Pointer somwriter = SomWriterType::New(); - somwriter->SetFileName(argv[9]/*"som.hd"*/); + somwriter->SetFileName(argv[9] /*"som.hd"*/); somwriter->SetInput(som->GetOutput()); somwriter->Update(); typedef unsigned char OutputPixelType; - typedef otb::Image<OutputPixelType,2> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> ActivationWriterType; - typedef otb::SOMActivationBuilder<SampleType,MapType,OutputImageType> SOMActivationBuilderType; + typedef otb::Image<OutputPixelType, 2> OutputImageType; + typedef otb::ImageFileWriter<OutputImageType> ActivationWriterType; + typedef otb::SOMActivationBuilder<SampleType, MapType, OutputImageType> SOMActivationBuilderType; SOMActivationBuilderType::Pointer somAct = SOMActivationBuilderType::New(); somAct->SetInput(som->GetOutput()); somAct->SetListSample(liste); ActivationWriterType::Pointer actWriter = ActivationWriterType::New(); - actWriter->SetFileName(argv[10]/*"actMap.png"*/); + actWriter->SetFileName(argv[10] /*"actMap.png"*/); actWriter->SetInput(somAct->GetOutput()); actWriter->Update(); //Classifier : - typedef otb::ImageFileReader<MapType> SOMReaderType; - typedef otb::SOMClassifier<SampleType,MapType,unsigned char> ClassifierType; + typedef otb::ImageFileReader<MapType> SOMReaderType; + typedef otb::SOMClassifier<SampleType, MapType, unsigned char> ClassifierType; SOMReaderType::Pointer somreader = SOMReaderType::New(); - somreader->SetFileName(argv[11]/*"som.mhd"*/); + somreader->SetFileName(argv[11] /*"som.mhd"*/); somreader->Update(); ClassifierType::Pointer classifier = ClassifierType::New(); @@ -172,8 +170,8 @@ int main(int argc, char* argv[] ) // // " class sample: "<< membershipSample->GetClassSample(m_iter.GetClassLabel())<< // std::endl; - //count[m_iter.GetClassLabel()]++; - ++m_iter; + //count[m_iter.GetClassLabel()]++; + ++m_iter; } /*for(int i=0;i<16;i++) @@ -182,16 +180,15 @@ int main(int argc, char* argv[] ) }*/ int nbclass = membershipSample->GetNumberOfClasses(); - std::cout<< " nb of classes= "<< nbclass << std::endl; + std::cout << " nb of classes= " << nbclass << std::endl; - for (int i=0; i< nbclass; i++) - { - if(membershipSample->GetInternalClassLabel(i)!=-1) + for (int i = 0; i < nbclass; i++) { - std::cout<<"classlabel= "<< i << " classSize= "<< membershipSample->GetClassSampleSize(i) <<std::endl; - } + if (membershipSample->GetInternalClassLabel(i) != -1) + { + std::cout << "classlabel= " << i << " classSize= " << membershipSample->GetClassSampleSize(i) << std::endl; + } } - return EXIT_SUCCESS; } diff --git a/Testing/Fa/PolygonsVectorization.cxx b/Testing/Fa/PolygonsVectorization.cxx index 816558e7ed..5a5651513f 100644 --- a/Testing/Fa/PolygonsVectorization.cxx +++ b/Testing/Fa/PolygonsVectorization.cxx @@ -47,30 +47,30 @@ #include "otbStandardWriterWatcher.h" #include "otbStandardFilterWatcher.h" -int main( int argc, char * argv[] ) +int main(int argc, char * argv[]) { - typedef unsigned char PixelType; - typedef unsigned long LabelPixelType; - typedef unsigned char PixelTypeOutput; + typedef unsigned char PixelType; + typedef unsigned long LabelPixelType; + typedef unsigned char PixelTypeOutput; - typedef otb::Image<PixelType,2> SingleImageType; - typedef otb::Image<LabelPixelType,2> LabeledImageType; - typedef otb::Image<PixelTypeOutput,2> OutputImageType; + typedef otb::Image<PixelType, 2> SingleImageType; + typedef otb::Image<LabelPixelType, 2> LabeledImageType; + typedef otb::Image<PixelTypeOutput, 2> OutputImageType; typedef itk::ImageRegionIterator<LabeledImageType> IteratorType; - typedef otb::Polygon<double> PolygonType; - typedef PolygonType::Pointer PolygonPointerType; - typedef PolygonType::ContinuousIndexType PolygonIndexType; - typedef otb::ObjectList<PolygonType> PolygonListType; - typedef PolygonListType::Pointer PolygonListPointerType; - typedef itk::ImageRegion<2> ImageRegionType; - - typedef otb::PersistentVectorizationImageFilter<LabeledImageType,PolygonType> PersistentVectorizationFilterType; - typedef itk::RelabelComponentImageFilter<LabeledImageType,LabeledImageType> RelabelFilterType; - typedef itk::ConnectedComponentImageFilter<LabeledImageType,LabeledImageType> ConnectedFilterType; - typedef itk::RescaleIntensityImageFilter<LabeledImageType,OutputImageType> RescalerType; + typedef otb::Polygon<double> PolygonType; + typedef PolygonType::Pointer PolygonPointerType; + typedef PolygonType::ContinuousIndexType PolygonIndexType; + typedef otb::ObjectList<PolygonType> PolygonListType; + typedef PolygonListType::Pointer PolygonListPointerType; + typedef itk::ImageRegion<2> ImageRegionType; + + typedef otb::PersistentVectorizationImageFilter<LabeledImageType, PolygonType> PersistentVectorizationFilterType; + typedef itk::RelabelComponentImageFilter<LabeledImageType, LabeledImageType> RelabelFilterType; + typedef itk::ConnectedComponentImageFilter<LabeledImageType, LabeledImageType> ConnectedFilterType; + typedef itk::RescaleIntensityImageFilter<LabeledImageType, OutputImageType> RescalerType; /* typedef itk::BinaryBallStructuringElement< LabelPixelType, 2 > StructuringElementType; typedef itk::BinaryErodeImageFilter<LabeledImageType,LabeledImageType,StructuringElementType> ErodeFilterType; @@ -81,48 +81,46 @@ int main( int argc, char * argv[] ) typedef otb::ImageFileReader<LabeledImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - //----------------------------------------------------------------- + //----------------------------------------------------------------- //Command Line Argument Parser try - { + { typedef otb::CommandLineArgumentParser ParserType; ParserType::Pointer parser = ParserType::New(); parser->SetProgramDescription("This program remove small objects"); parser->AddInputImage(); parser->AddOutputImage(); - parser->AddOption("--surface","objects surface limit. Default is 100","-s",1,false); - parser->AddOption("--outputText","output text file name","-ot",1,false); + parser->AddOption("--surface", "objects surface limit. Default is 100", "-s", 1, false); + parser->AddOption("--outputText", "output text file name", "-ot", 1, false); typedef otb::CommandLineArgumentParseResult ParserResultType; - ParserResultType::Pointer parseResult = ParserResultType::New(); + ParserResultType::Pointer parseResult = ParserResultType::New(); try - { - parser->ParseCommandLine(argc,argv,parseResult); - } - catch( itk::ExceptionObject & err ) - { - std::string descriptionException = err.GetDescription(); - if(descriptionException.find("ParseCommandLine(): Help Parser") - != std::string::npos) { - return EXIT_SUCCESS; + parser->ParseCommandLine(argc, argv, parseResult); } - if(descriptionException.find("ParseCommandLine(): Version Parser") - != std::string::npos) + catch (itk::ExceptionObject& err) { + std::string descriptionException = err.GetDescription(); + if (descriptionException.find("ParseCommandLine(): Help Parser") + != std::string::npos) + { return EXIT_SUCCESS; - } + } + if (descriptionException.find("ParseCommandLine(): Version Parser") + != std::string::npos) + { + return EXIT_SUCCESS; + } return EXIT_FAILURE; - } + } //object under this value will be removed double surfaceLimit; - if (parseResult->IsOptionPresent("--surface")) - surfaceLimit = parseResult->GetParameterDouble("--surface"); - else - surfaceLimit = 100; + if (parseResult->IsOptionPresent("--surface")) surfaceLimit = parseResult->GetParameterDouble("--surface"); + else surfaceLimit = 100; //----------------------------------------------------------------- //read image @@ -144,88 +142,91 @@ int main( int argc, char * argv[] ) PersistentVectorizationFilterType::Pointer persistentVectorization = PersistentVectorizationFilterType::New(); persistentVectorization->Reset(); persistentVectorization->SetInput(connectedFilter->GetOutput()); - try{ + try + { persistentVectorization->Update(); - } - catch ( itk::ExceptionObject &err){ + } + catch (itk::ExceptionObject& err) + { std::cout << "\nExceptionObject caught !" << std::endl; std::cout << err << std::endl; return EXIT_FAILURE; - } + } PolygonListPointerType OutputPolyList = persistentVectorization->GetPathList(); //Display results - std::cout <<"nb objects found = " << OutputPolyList->Size() << std::endl; + std::cout << "nb objects found = " << OutputPolyList->Size() << std::endl; //------------------- //DEBUG //------------------- - unsigned int polygon=0; + unsigned int polygon = 0; std::ofstream file; if (parseResult->IsOptionPresent("--outputText")) - { + { file.open(parseResult->GetParameterString("--outputText").c_str()); - } + } - double minSize=-1; + double minSize = -1; //Initializing the minSize if (OutputPolyList->Size() > 0) - { - minSize=OutputPolyList->GetNthElement(0)->GetArea(); - } + { + minSize = OutputPolyList->GetNthElement(0)->GetArea(); + } - while(polygon < OutputPolyList->Size()){ + while (polygon < OutputPolyList->Size()) + { ImageRegionType polygonRegion = OutputPolyList->GetNthElement(polygon)->GetBoundingRegion().GetImageRegion(); if (OutputPolyList->GetNthElement(polygon)->GetArea() < minSize) - { + { minSize = OutputPolyList->GetNthElement(polygon)->GetArea(); - } + } if (parseResult->IsOptionPresent("--outputText")) - { + { file << "polygon " << polygon << "\tnPoints=" - << OutputPolyList->GetNthElement(polygon)->GetVertexList()->Size() << "\tsurface=" - << OutputPolyList->GetNthElement(polygon)->GetArea()<< "\tlength=" - << OutputPolyList->GetNthElement(polygon)->GetLength() << "\tregion size=" - << polygonRegion.GetSize() <<"\tregion nb pixel=" - << polygonRegion.GetNumberOfPixels() << std::endl; + << OutputPolyList->GetNthElement(polygon)->GetVertexList()->Size() << "\tsurface=" + << OutputPolyList->GetNthElement(polygon)->GetArea() << "\tlength=" + << OutputPolyList->GetNthElement(polygon)->GetLength() << "\tregion size=" + << polygonRegion.GetSize() << "\tregion nb pixel=" + << polygonRegion.GetNumberOfPixels() << std::endl; // file << OutputPolyList->GetNthElement(polygon)<< std::endl << std::endl; - } + } else - { - std::cout << "polygon " << polygon << "\tnPoints=" - << OutputPolyList->GetNthElement(polygon)->GetVertexList()->Size() << "\tsurface=" - << OutputPolyList->GetNthElement(polygon)->GetArea()<< "\tlength=" - << OutputPolyList->GetNthElement(polygon)->GetLength() << "\tregion size=" - << polygonRegion.GetSize() <<"\tregion nb pixel=" - << polygonRegion.GetNumberOfPixels() << std::endl; + { + std::cout << "polygon " << polygon << "\tnPoints=" + << OutputPolyList->GetNthElement(polygon)->GetVertexList()->Size() << "\tsurface=" + << OutputPolyList->GetNthElement(polygon)->GetArea() << "\tlength=" + << OutputPolyList->GetNthElement(polygon)->GetLength() << "\tregion size=" + << polygonRegion.GetSize() << "\tregion nb pixel=" + << polygonRegion.GetNumberOfPixels() << std::endl; // std::cout << OutputPolyList->GetNthElement(polygon)<< std::endl << std::endl; - } + } polygon++; - } + } if (parseResult->IsOptionPresent("--outputText")) - { + { file.close(); - } + } //------------------- // END DEBUG //------------------- //----------------------------------------------------------------- //erase object - unsigned int i=0; - std::cout <<"erase ..." << std::endl; - while(i < OutputPolyList->Size()){ + unsigned int i = 0; + std::cout << "erase ..." << std::endl; + while (i < OutputPolyList->Size()) + { if ((OutputPolyList->GetNthElement(i)->GetArea() > surfaceLimit) //delete big polygon - ||(OutputPolyList->GetNthElement(i)->GetArea() == 0)) //delete invalid polygon + || (OutputPolyList->GetNthElement(i)->GetArea() == 0)) //delete invalid polygon OutputPolyList->Erase(i); - else - i++; - } + else i++; + } //Display results after erasure - std::cout <<"nb objects found = " << OutputPolyList->Size() << std::endl; - std::cout <<"------------------------------------------------" << std::endl; + std::cout << "nb objects found = " << OutputPolyList->Size() << std::endl; + std::cout << "------------------------------------------------" << std::endl; /////////////////////////////////////////////////////////////////// // Output Image Writing @@ -234,81 +235,80 @@ int main( int argc, char * argv[] ) //----------------------------------------------------------------- //allocate the memory for the output file LabeledImageType::Pointer outputImage = LabeledImageType::New(); - outputImage->SetRegions( reader->GetOutput()->GetRequestedRegion() ); - outputImage->CopyInformation( reader->GetOutput() ); + outputImage->SetRegions(reader->GetOutput()->GetRequestedRegion()); + outputImage->CopyInformation(reader->GetOutput()); outputImage->Allocate(); // copy input - IteratorType iit(reader->GetOutput(),reader->GetOutput()->GetRequestedRegion()); - IteratorType oit(outputImage,outputImage->GetRequestedRegion()); + IteratorType iit(reader->GetOutput(), reader->GetOutput()->GetRequestedRegion()); + IteratorType oit(outputImage, outputImage->GetRequestedRegion()); - for (iit.GoToBegin(),oit.GoToBegin(); !iit.IsAtEnd(); ++iit,++oit) - oit.Set(iit.Get()); + for (iit.GoToBegin(), oit.GoToBegin(); !iit.IsAtEnd(); ++iit, ++oit) + oit.Set(iit.Get()); // erase small polygon - for(unsigned int i = 0; i < OutputPolyList->Size(); i++){ - std::cout << "polygon "<< i << std::endl; + for (unsigned int i = 0; i < OutputPolyList->Size(); i++) + { + std::cout << "polygon " << i << std::endl; ImageRegionType polygonRegion = OutputPolyList->GetNthElement(i)->GetBoundingRegion().GetImageRegion(); - IteratorType outputIt(outputImage,polygonRegion); + IteratorType outputIt(outputImage, polygonRegion); outputIt.GoToBegin(); - while(!outputIt.IsAtEnd()) - { + while (!outputIt.IsAtEnd()) + { outputIt.Set(0); ++outputIt; - } + } - } + } //----------------------------------------------------------------- //rescale image RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetOutputMinimum(0); rescaler->SetOutputMaximum(255); - rescaler->SetInput( outputImage ); + rescaler->SetInput(outputImage); rescaler->Update(); //----------------------------------------------------------------- //write image WriterType::Pointer writer = WriterType::New(); writer->SetFileName(parseResult->GetOutputImage().c_str()); - writer->SetInput( rescaler->GetOutput() ); + writer->SetInput(rescaler->GetOutput()); try - { - otb::StandardWriterWatcher watcher(writer, "Remove small object"); - writer->Update(); - } - catch ( itk::ExceptionObject &err) - { - std::cout << "ExceptionObject caught !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } + { + otb::StandardWriterWatcher watcher(writer, "Remove small object"); + writer->Update(); + } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught !" << std::endl; + std::cout << err << std::endl; + return EXIT_FAILURE; + } if (minSize == 0) - { + { return EXIT_FAILURE; - } + } - }//end block try global - catch( itk::ExceptionObject & err ) - { + } //end block try global + catch (itk::ExceptionObject& err) + { std::cout << "Following otbException catch :" << std::endl; std::cout << err << std::endl; return EXIT_FAILURE; - } - catch( std::bad_alloc & err ) - { - std::cout << "Exception bad_alloc : "<<(char*)err.what()<< std::endl; + } + catch (std::bad_alloc& err) + { + std::cout << "Exception bad_alloc : " << (char*) err.what() << std::endl; return EXIT_FAILURE; - } - catch( ... ) - { + } + catch (...) + { std::cout << "Unknown Exception found !" << std::endl; return EXIT_FAILURE; - } + } return EXIT_SUCCESS; } - - diff --git a/Testing/Fa/StreamingStat.cxx b/Testing/Fa/StreamingStat.cxx index 46e3438249..68c8a5b7ea 100644 --- a/Testing/Fa/StreamingStat.cxx +++ b/Testing/Fa/StreamingStat.cxx @@ -1,4 +1,3 @@ - #include "otbImage.h" #include "otbVectorImage.h" #include "otbImageFileReader.h" @@ -8,23 +7,21 @@ int main(int argc, char ** argv) { - typedef otb::Image< double, 2 > ImageType; - typedef otb::Image< double, 3 > Image3DType; - typedef otb::VectorImage< double, 2 > VectorImageType; - typedef otb::ImageFileReader< VectorImageType > ReaderType; + typedef otb::Image<double, 2> ImageType; + typedef otb::Image<double, 3> Image3DType; + typedef otb::VectorImage<double, 2> VectorImageType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; ReaderType::Pointer reader1 = ReaderType::New(); - reader1->SetFileName( argv[1] ); - + reader1->SetFileName(argv[1]); typedef otb::VectorImageTo3DScalarImageFilter<VectorImageType, Image3DType> - VectorImageTo3DScalarImageFilterType; + VectorImageTo3DScalarImageFilterType; VectorImageTo3DScalarImageFilterType::Pointer filter1 = - VectorImageTo3DScalarImageFilterType::New(); - + VectorImageTo3DScalarImageFilterType::New(); typedef otb::StreamingStatisticsImageFilter<Image3DType> statFilterType; - statFilterType::Pointer statFilter= statFilterType::New(); + statFilterType::Pointer statFilter = statFilterType::New(); filter1->SetInput(reader1->GetOutput()); // filter1->Update(); @@ -33,5 +30,4 @@ int main(int argc, char ** argv) std::cout << statFilter->GetMean() << std::endl; - } -- GitLab